Class: HTMLRender::RenderTest::Result::ServerResult
- Inherits:
-
Object
- Object
- HTMLRender::RenderTest::Result::ServerResult
- Defined in:
- lib/html_render/render_test.rb
Overview
The portion of a result specific to an individual server
Instance Attribute Summary collapse
-
#actual_path ⇒ Object
readonly
Returns the value of attribute actual_path.
-
#expected_path ⇒ Object
readonly
Returns the value of attribute expected_path.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #actual ⇒ Object
- #difference ⇒ Object
- #expected ⇒ Object
-
#initialize(server, expected_path, actual_path) ⇒ ServerResult
constructor
Initializes the ServerResult.
- #pass? ⇒ Boolean
Constructor Details
#initialize(server, expected_path, actual_path) ⇒ ServerResult
Initializes the ServerResult.
Params:
server: name of the server
expected_path: Path to image we expected
actual_path: Path to image we got
18 19 20 21 22 |
# File 'lib/html_render/render_test.rb', line 18 def initialize(server, expected_path, actual_path) @server = server @expected_path = expected_path @actual_path = actual_path end |
Instance Attribute Details
#actual_path ⇒ Object (readonly)
Returns the value of attribute actual_path.
10 11 12 |
# File 'lib/html_render/render_test.rb', line 10 def actual_path @actual_path end |
#expected_path ⇒ Object (readonly)
Returns the value of attribute expected_path.
10 11 12 |
# File 'lib/html_render/render_test.rb', line 10 def expected_path @expected_path end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
10 11 12 |
# File 'lib/html_render/render_test.rb', line 10 def server @server end |
Instance Method Details
#actual ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/html_render/render_test.rb', line 32 def actual @actual ||= if actual_path File.open(actual_path) do |f| HTMLRender::Images::PNGImage.new(f.read) end end end |
#difference ⇒ Object
44 45 46 |
# File 'lib/html_render/render_test.rb', line 44 def difference expected.difference(actual) end |
#expected ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/html_render/render_test.rb', line 24 def expected @expected ||= if expected_path File.open(expected_path) do |f| HTMLRender::Images::PNGImage.new(f.read) end end end |
#pass? ⇒ Boolean
40 41 42 |
# File 'lib/html_render/render_test.rb', line 40 def pass? actual == expected end |