1
- module Rasta
2
- module Fixture
3
-
4
- module BaseFixture
5
- include Rasta ::Spreadsheet
6
-
7
- def initialize_test_fixture ( roo_reference )
8
- @oo = roo_reference
9
- @metrics = Metrics . new
10
- end
11
-
12
- # Call into rspec to run the current set of tests
13
- # and then remove the example from the group which
14
- # if we dont will run test 1 then test 1,2 then test 1,2,3
15
- # and we'll get duplicate test results accordingly
16
- def run_rspec_test
17
- Spec ::Runner . options . run_examples
18
- Spec ::Runner . options . remove_example_group ( Spec ::Runner . options . example_groups [ 0 ] )
19
- end
20
-
21
- # Allow access to the current failure count from RSpec
22
- # which will let us change the tab color based on the test results
23
- def current_failure_count
24
- Spec ::Runner . options . reporter . failure_count
25
- end
26
-
27
- # def select_output_cell(c, f)
28
- # Spec::Runner.options.reporter.set_current_spreadsheet_cell(c,f)
29
- # end
30
-
31
- # Iterate over spreadsheet cells, create the
32
- # test fixtures and call your test. Generally
33
- # you will need to iterate over the spreadsheet
34
- # cells and once you have the information you need
35
- # to actually run the rspec test you should
36
- # use:
37
- # select_output_cell(cell)
38
- # This tells the reporter which spreadsheet
39
- # cell should get the results
40
- # create_rspec_test(test_fixture, cell)
41
- # This is a method you create which will create
42
- # rspec testcase(s) based on the inputs
43
- # run_rspec_test
44
- # This will run the test set up by create_test
45
- def generate_rspec_tests
46
- end
47
-
48
- # This is the guts of the rspec test you want to call
49
- # so for example something like
50
- #
51
- # describe 'test' do
52
- # before(:all) do
53
- # end
54
- # it "testcase 1" do
55
- # end
56
- # it "testcase 2" do
57
- # end
58
- # ... etc ...
59
- # after(:all) do
60
- # end
61
- # end
62
- def create_rspec_test ( args )
63
- end
64
-
65
- # This is called by the fixture before any test
66
- # is run on the worksheet so you can perform any
67
- # setup needed
68
- #def before_all
69
- #end
70
-
71
- # This method is called before each set of tests
72
- # typically a row or column of tests or potentially
73
- # before each cell, depending on the fixture
74
- #def before_each
75
- #end
76
-
77
- # This method is called after each set of tests
78
- # typically a row or column of tests or potentially
79
- # after each cell, depending on the fixture
80
- #def after_each
81
- #end
82
-
83
- # This is called by the fixture after all tests
84
- # are run on the worksheet so you can perform any
85
- # teardown needed
86
- #def after_all
87
- #end
88
-
89
-
90
- # Store metrics as the fixture is running
91
- class Metrics
92
- attr_accessor :attribute_count , :method_count , :record_count
93
- def initialize
94
- reset_page_counts
95
- reset_record_counts
96
- end
97
- # Counts tracked on a worksheet scope
98
- def reset_page_counts
99
- @record_count = 0
100
- end
101
- # Counts tracked on a record scope
102
- def reset_record_counts
103
- @attribute_count = 0
104
- @method_count = 0
105
- end
106
- def inc ( attribute_name )
107
- eval ( "@#{ attribute_name . to_s } += 1" )
108
- end
109
- end
110
-
111
- end
112
- end
1
+ module Rasta
2
+ module Fixture
3
+
4
+ module BaseFixture
5
+ include Rasta ::Spreadsheet
6
+
7
+ def initialize_test_fixture ( roo_reference )
8
+ @oo = roo_reference
9
+ @metrics = Metrics . new
10
+ end
11
+
12
+ # Call into rspec to run the current set of tests
13
+ # and then remove the example from the group which
14
+ # if we dont will run test 1 then test 1,2 then test 1,2,3
15
+ # and we'll get duplicate test results accordingly
16
+ def run_rspec_test
17
+ Spec ::Runner . options . run_examples
18
+ Spec ::Runner . options . remove_example_group ( Spec ::Runner . options . example_groups [ 0 ] )
19
+ end
20
+
21
+ # Allow access to the current failure count from RSpec
22
+ # which will let us change the tab color based on the test results
23
+ def current_failure_count
24
+ Spec ::Runner . options . reporter . failure_count
25
+ end
26
+
27
+ # def select_output_cell(c, f)
28
+ # Spec::Runner.options.reporter.set_current_spreadsheet_cell(c,f)
29
+ # end
30
+
31
+ # Iterate over spreadsheet cells, create the
32
+ # test fixtures and call your test. Generally
33
+ # you will need to iterate over the spreadsheet
34
+ # cells and once you have the information you need
35
+ # to actually run the rspec test you should
36
+ # use:
37
+ # select_output_cell(cell)
38
+ # This tells the reporter which spreadsheet
39
+ # cell should get the results
40
+ # create_rspec_test(test_fixture, cell)
41
+ # This is a method you create which will create
42
+ # rspec testcase(s) based on the inputs
43
+ # run_rspec_test
44
+ # This will run the test set up by create_test
45
+ def generate_rspec_tests
46
+ end
47
+
48
+ # This is the guts of the rspec test you want to call
49
+ # so for example something like
50
+ #
51
+ # describe 'test' do
52
+ # before(:all) do
53
+ # end
54
+ # it "testcase 1" do
55
+ # end
56
+ # it "testcase 2" do
57
+ # end
58
+ # ... etc ...
59
+ # after(:all) do
60
+ # end
61
+ # end
62
+ def create_rspec_test ( args )
63
+ end
64
+
65
+ # This is called by the fixture before any test
66
+ # is run on the worksheet so you can perform any
67
+ # setup needed
68
+ #def before_all
69
+ #end
70
+
71
+ # This method is called before each set of tests
72
+ # typically a row or column of tests or potentially
73
+ # before each cell, depending on the fixture
74
+ #def before_each
75
+ #end
76
+
77
+ # This method is called after each set of tests
78
+ # typically a row or column of tests or potentially
79
+ # after each cell, depending on the fixture
80
+ #def after_each
81
+ #end
82
+
83
+ # This is called by the fixture after all tests
84
+ # are run on the worksheet so you can perform any
85
+ # teardown needed
86
+ #def after_all
87
+ #end
88
+
89
+
90
+ # Store metrics as the fixture is running
91
+ class Metrics
92
+ attr_accessor :attribute_count , :method_count , :record_count
93
+ def initialize
94
+ reset_page_counts
95
+ reset_record_counts
96
+ end
97
+ # Counts tracked on a worksheet scope
98
+ def reset_page_counts
99
+ @record_count = 0
100
+ end
101
+ # Counts tracked on a record scope
102
+ def reset_record_counts
103
+ @attribute_count = 0
104
+ @method_count = 0
105
+ end
106
+ def inc ( attribute_name )
107
+ eval ( "@#{ attribute_name . to_s } += 1" )
108
+ end
109
+ end
110
+
111
+ end
112
+ end
113
113
end
0 commit comments