Class: Eg::ExampleTests

Inherits:
Fit::ColumnFixture show all
Defined in:
lib/eg/example_tests.rb

Constant Summary

Constants inherited from Fit::Fixture

Fit::Fixture::GRAY, Fit::Fixture::GREEN, Fit::Fixture::RED, Fit::Fixture::YELLOW

Instance Attribute Summary collapse

Attributes inherited from Fit::Fixture

#args, #counts, #listener, #summary

Instance Method Summary collapse

Methods inherited from Fit::ColumnFixture

#check, #do_cell, #do_rows, #execute, #reset

Methods inherited from Fit::Fixture

camel, #check, #do_cell, #do_cells, #do_rows, #do_table, #do_tables, #error, escape, #exception, #find_class, #fixture_name, #get_args_for_table, #get_linked_fixture_with_args, gray, #ignore, #info, #interpret_following_tables, #interpret_tables, label, metadata, #parse, #total_errors, #totals

Constructor Details

#initializeExampleTests

Returns a new instance of ExampleTests.



15
16
17
18
# File 'lib/eg/example_tests.rb', line 15

def initialize
  @run_counts = Fit::Counts.new
  @footnote = nil
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



9
10
11
# File 'lib/eg/example_tests.rb', line 9

def file
  @file
end

#wikiObject

Returns the value of attribute wiki.



9
10
11
# File 'lib/eg/example_tests.rb', line 9

def wiki
  @wiki
end

Instance Method Details

#do_row(row) ⇒ Object

Footnote



60
61
62
63
# File 'lib/eg/example_tests.rb', line 60

def do_row row
  @file_cell = row.leaf
  super
end

#exceptionsObject



54
55
56
# File 'lib/eg/example_tests.rb', line 54

def exceptions
  @fixture.counts.exceptions
end

#ignoresObject



50
51
52
# File 'lib/eg/example_tests.rb', line 50

def ignores
  @fixture.counts.ignores
end

#right(arg0 = nil) ⇒ Object

The right method is more complicated than the one in the original Java FIT version because Ruby does not see different methods based on the number of their arguments: here, ExampleTests#right shadows Fixture#right, so it must serve two roles at the same time.



41
42
43
44
45
46
47
48
# File 'lib/eg/example_tests.rb', line 41

def right arg0 = nil
  unless arg0.nil?
    super
  else
    run
    @fixture.counts.right
  end
end

#wiki?Boolean

Returns:

  • (Boolean)


20
# File 'lib/eg/example_tests.rb', line 20

def wiki?; @wiki; end

#wrong(cell = nil, actual = nil) ⇒ Object

The wrong method is more complicated than the one (two, actually) in the original Java FIT version because Ruby does not see different methods based based on the number of their arguments: here, the method ExampleTests#wrong shadows Fixture#wrong, so it must serve two (three, actually) roles at the same time.



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/eg/example_tests.rb', line 70

def wrong cell = nil, actual = nil
  if cell.nil?
    @fixture.counts.wrong
  else
    super
    if @footnote.nil?
      @footnote = @tables.footnote
      @file_cell.add_to_body footnote
    end
  end
end