Class: GreenPepper::ExampleWithFixture
- Inherits:
-
Object
- Object
- GreenPepper::ExampleWithFixture
- Defined in:
- lib/greenpepper/example/examplewithfixture.rb
Direct Known Subclasses
CollectionExample, DoWithExample, RuleForExample, SetupExample
Constant Summary collapse
- EXAMPLE_NAME_ROW =
0
- EXAMPLE_NAME_COLUMN =
0
- FIXTURE_NAME_ROW =
0
- FIXTURE_NAME_COLUMN =
1
- HEADER_ROW =
1
- FIRST_DATA_ROW =
1
Instance Attribute Summary collapse
-
#fixture_arguments ⇒ Object
Returns the value of attribute fixture_arguments.
-
#fixture_name ⇒ Object
Returns the value of attribute fixture_name.
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
- #add_fixture_argument(value) ⇒ Object
- #execute ⇒ Object
-
#initialize(fixture_name) ⇒ ExampleWithFixture
constructor
A new instance of ExampleWithFixture.
Constructor Details
#initialize(fixture_name) ⇒ ExampleWithFixture
Returns a new instance of ExampleWithFixture.
20 21 22 23 24 25 26 27 28 |
# File 'lib/greenpepper/example/examplewithfixture.rb', line 20 def initialize(fixture_name) if fixture_name == nil raise GreenPepperMalformedTableError.new( 'No fixture name provided') end @fixture_name = fixture_name @fixture_arguments = [] @headers = [] end |
Instance Attribute Details
#fixture_arguments ⇒ Object
Returns the value of attribute fixture_arguments.
11 12 13 |
# File 'lib/greenpepper/example/examplewithfixture.rb', line 11 def fixture_arguments @fixture_arguments end |
#fixture_name ⇒ Object
Returns the value of attribute fixture_name.
11 12 13 |
# File 'lib/greenpepper/example/examplewithfixture.rb', line 11 def fixture_name @fixture_name end |
#headers ⇒ Object
Returns the value of attribute headers.
11 12 13 |
# File 'lib/greenpepper/example/examplewithfixture.rb', line 11 def headers @headers end |
Instance Method Details
#add_fixture_argument(value) ⇒ Object
30 31 32 33 |
# File 'lib/greenpepper/example/examplewithfixture.rb', line 30 def add_fixture_argument(value) @fixture_arguments << TypeConverter.instance.convert_string(value) end |
#execute ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/greenpepper/example/examplewithfixture.rb', line 35 def execute fixture_class = NameResolver.solve_fixture_name(@fixture_name) results = HtmlTableExecutionResults.new if fixture_class.nil? results.add FIXTURE_NAME_ROW, FIXTURE_NAME_COLUMN, ErrorExampleResult.new return results end begin check_headers fixture_class, results, HEADER_ROW do_execute results, fixture_class rescue GreenPepperError => e raise e rescue Exception => e results.add FIXTURE_NAME_ROW, FIXTURE_NAME_COLUMN, WriteExceptionExampleResult.new(e) end results end |