Class: GreenPepper::WriteExpectedExampleResult

Inherits:
FailureExampleResult show all
Defined in:
lib/greenpepper/writer/htmlresult.rb

Instance Attribute Summary collapse

Attributes inherited from HtmlExampleResult

#column, #row

Attributes inherited from ExampleResult

#silent

Instance Method Summary collapse

Methods inherited from FailureExampleResult

#failure?

Methods inherited from ExampleResult

#error?, #failure?, #ignored?, #success?, #update_stats

Constructor Details

#initialize(expected, received, silent = false) ⇒ WriteExpectedExampleResult

Returns a new instance of WriteExpectedExampleResult.



114
115
116
117
118
# File 'lib/greenpepper/writer/htmlresult.rb', line 114

def initialize(expected, received, silent=false)
  super(silent)
  @expected = expected
  @received = received
end

Instance Attribute Details

#expectedObject (readonly)

Returns the value of attribute expected.



113
114
115
# File 'lib/greenpepper/writer/htmlresult.rb', line 113

def expected
  @expected
end

#receivedObject (readonly)

Returns the value of attribute received.



113
114
115
# File 'lib/greenpepper/writer/htmlresult.rb', line 113

def received
  @received
end

Instance Method Details

#write(cell, options = {}) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/greenpepper/writer/htmlresult.rb', line 120

def write(cell, options = {})
  cell = super(cell, options)
  
  cell.children.each{|current_node|current_node.remove!}
  cell << LibXML::XML::Node.new_text("")

  expected_node = LibXML::XML::Node.new "b", "Expected: "
  cell << expected_node
  cell << @expected 

  received_node = LibXML::XML::Node.new "b", " Received: "
  cell << received_node
  cell << @received 
end