Module: StonesSpec::WithGbbHtmlRendering
- Included in:
- Postcondition::ExpectedBoom, Postcondition::ExpectedResult
- Defined in:
- lib/stones_spec/with_gbb_html_rendering.rb
Instance Method Summary collapse
- #get_html_board(caption, gbb_representation) ⇒ Object
- #make_boards_output(title, gbb_boards, status, extra = nil) ⇒ Object
- #make_error_output(result, initial_board_gbb) ⇒ Object
Instance Method Details
#get_html_board(caption, gbb_representation) ⇒ Object
3 4 5 |
# File 'lib/stones_spec/with_gbb_html_rendering.rb', line 3 def get_html_board(caption, gbb_representation) HtmlBoardRenderer.new(caption: caption).render(Stones::GbbReader.new.from_string gbb_representation) end |
#make_boards_output(title, gbb_boards, status, extra = nil) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/stones_spec/with_gbb_html_rendering.rb', line 16 def make_boards_output(title, gbb_boards, status, extra = nil) boards = gbb_boards.map { |gbb_with_caption| get_html_board *gbb_with_caption }.join("\n") output = "<div>#{boards}</div>" output = "<p>#{extra}</p>\n#{output}" if extra [title, status, output] end |
#make_error_output(result, initial_board_gbb) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/stones_spec/with_gbb_html_rendering.rb', line 7 def make_error_output(result, initial_board_gbb) = Gobstones. result if Gobstones.runtime_error? "#{get_html_board 'Tablero inicial', initial_board_gbb}\n#{get_boom_board initial_board_gbb}\n#{}" else end end |