cuke_modeler 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.rdoc +8 -0
- data/features/step_definitions/feature_steps.rb +1 -1
- data/features/step_definitions/test_steps.rb +6 -2
- data/lib/cuke_modeler/directory.rb +7 -10
- data/lib/cuke_modeler/version.rb +1 -1
- data/spec/integration/background_integration_spec.rb +53 -40
- data/spec/integration/directory_integration_spec.rb +39 -26
- data/spec/integration/doc_string_integration_spec.rb +51 -43
- data/spec/integration/example_integration_spec.rb +71 -60
- data/spec/integration/feature_file_integration_spec.rb +36 -22
- data/spec/integration/feature_integration_spec.rb +113 -104
- data/spec/integration/outline_integration_spec.rb +71 -56
- data/spec/integration/row_integration_spec.rb +72 -0
- data/spec/integration/scenario_integration_spec.rb +61 -46
- data/spec/integration/step_integration_spec.rb +126 -117
- data/spec/integration/table_integration_spec.rb +67 -52
- data/spec/integration/table_row_integration_spec.rb +48 -40
- data/spec/integration/tag_integration_spec.rb +53 -45
- data/spec/integration/world_integration_spec.rb +2 -1
- data/spec/spec_helper.rb +15 -12
- data/spec/unit/background_unit_spec.rb +65 -50
- data/spec/unit/bare_bones_unit_specs.rb +2 -3
- data/spec/unit/containing_element_unit_specs.rb +6 -7
- data/spec/unit/directory_unit_spec.rb +103 -64
- data/spec/unit/doc_string_unit_spec.rb +113 -95
- data/spec/unit/example_unit_spec.rb +235 -219
- data/spec/unit/feature_element_unit_spec.rb +6 -6
- data/spec/unit/feature_element_unit_specs.rb +28 -24
- data/spec/unit/feature_file_unit_spec.rb +73 -63
- data/spec/unit/feature_unit_spec.rb +145 -111
- data/spec/unit/nested_element_unit_specs.rb +14 -13
- data/spec/unit/nested_unit_spec.rb +24 -21
- data/spec/unit/outline_unit_spec.rb +92 -78
- data/spec/unit/parsing_unit_spec.rb +55 -51
- data/spec/unit/prepopulated_unit_specs.rb +2 -3
- data/spec/unit/raw_element_unit_specs.rb +12 -11
- data/spec/unit/raw_unit_spec.rb +15 -12
- data/spec/unit/row_unit_spec.rb +68 -52
- data/spec/unit/scenario_unit_spec.rb +76 -62
- data/spec/unit/sourceable_unit_spec.rb +8 -6
- data/spec/unit/sourced_element_unit_specs.rb +4 -6
- data/spec/unit/step_unit_spec.rb +231 -203
- data/spec/unit/table_row_unit_spec.rb +68 -52
- data/spec/unit/table_unit_spec.rb +100 -82
- data/spec/unit/tag_unit_spec.rb +62 -48
- data/spec/unit/taggable_unit_spec.rb +58 -51
- data/spec/unit/tagged_element_unit_specs.rb +28 -26
- data/spec/unit/test_element_unit_spec.rb +33 -27
- data/spec/unit/test_element_unit_specs.rb +15 -14
- data/spec/unit/world_unit_spec.rb +94 -84
- metadata +4 -2
@@ -4,9 +4,8 @@ shared_examples_for 'a prepopulated element' do
|
|
4
4
|
|
5
5
|
# clazz must be defined by the calling file
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
end
|
7
|
+
let(:element) { clazz.new }
|
8
|
+
|
10
9
|
|
11
10
|
it 'can take an argument' do
|
12
11
|
(clazz.instance_method(:initialize).arity != 0).should be_true
|
@@ -4,23 +4,24 @@ shared_examples_for 'a raw element' do
|
|
4
4
|
|
5
5
|
# clazz must be defined by the calling file
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
end
|
7
|
+
let(:element) { clazz.new }
|
8
|
+
|
10
9
|
|
11
|
-
it 'has an underlying implementation representation
|
12
|
-
|
10
|
+
it 'has an underlying implementation representation' do
|
11
|
+
element.should respond_to(:raw_element)
|
13
12
|
end
|
14
13
|
|
15
|
-
it 'can
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
it 'can change its underlying implementation representation' do
|
15
|
+
expect(element).to respond_to(:raw_element=)
|
16
|
+
|
17
|
+
element.raw_element = :some_raw_element
|
18
|
+
element.raw_element.should == :some_raw_element
|
19
|
+
element.raw_element = :some_other_raw_element
|
20
|
+
element.raw_element.should == :some_other_raw_element
|
20
21
|
end
|
21
22
|
|
22
23
|
it 'starts with no underlying implementation representation' do
|
23
|
-
|
24
|
+
element.raw_element.should == nil
|
24
25
|
end
|
25
26
|
|
26
27
|
end
|
data/spec/unit/raw_unit_spec.rb
CHANGED
@@ -4,22 +4,25 @@ SimpleCov.command_name('Raw') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
4
|
|
5
5
|
describe 'Raw, Unit' do
|
6
6
|
|
7
|
-
nodule
|
7
|
+
let(:nodule) { CukeModeler::Raw }
|
8
|
+
let(:element) { Object.new.extend(nodule) }
|
8
9
|
|
9
|
-
before(:each) do
|
10
|
-
@element = Object.new.extend(nodule)
|
11
|
-
end
|
12
10
|
|
11
|
+
describe 'unique behavior' do
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
it 'has a raw element' do
|
14
|
+
element.should respond_to(:raw_element)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'can change its raw element' do
|
18
|
+
expect(element).to respond_to(:raw_element=)
|
19
|
+
|
20
|
+
element.raw_element = :some_raw_element
|
21
|
+
element.raw_element.should == :some_raw_element
|
22
|
+
element.raw_element = :some_other_raw_element
|
23
|
+
element.raw_element.should == :some_other_raw_element
|
24
|
+
end
|
17
25
|
|
18
|
-
it 'can get and set its raw element - #raw_element, #raw_element=' do
|
19
|
-
@element.raw_element = :some_raw_element
|
20
|
-
@element.raw_element.should == :some_raw_element
|
21
|
-
@element.raw_element = :some_other_raw_element
|
22
|
-
@element.raw_element.should == :some_other_raw_element
|
23
26
|
end
|
24
27
|
|
25
28
|
end
|
data/spec/unit/row_unit_spec.rb
CHANGED
@@ -5,80 +5,96 @@ SimpleCov.command_name('Row') unless RUBY_VERSION.to_s < '1.9.0'
|
|
5
5
|
describe 'Row, Unit' do
|
6
6
|
|
7
7
|
let(:clazz) { CukeModeler::Row }
|
8
|
+
let(:row) { clazz.new }
|
8
9
|
|
9
|
-
it_should_behave_like 'a nested element'
|
10
|
-
it_should_behave_like 'a bare bones element'
|
11
|
-
it_should_behave_like 'a prepopulated element'
|
12
|
-
it_should_behave_like 'a sourced element'
|
13
|
-
it_should_behave_like 'a raw element'
|
14
10
|
|
15
|
-
|
16
|
-
source = '| a | row |'
|
11
|
+
describe 'common behavior' do
|
17
12
|
|
18
|
-
|
13
|
+
it_should_behave_like 'a nested element'
|
14
|
+
it_should_behave_like 'a bare bones element'
|
15
|
+
it_should_behave_like 'a prepopulated element'
|
16
|
+
it_should_behave_like 'a sourced element'
|
17
|
+
it_should_behave_like 'a raw element'
|
19
18
|
|
20
|
-
# Sanity check in case instantiation failed in a non-explosive manner
|
21
|
-
@element.cells.should == ['a', 'row']
|
22
19
|
end
|
23
20
|
|
24
|
-
it 'provides a descriptive filename when being parsed from stand alone text' do
|
25
|
-
source = " |bad |row| text| \n @foo "
|
26
21
|
|
27
|
-
|
28
|
-
end
|
22
|
+
describe 'unique behavior' do
|
29
23
|
|
30
|
-
|
31
|
-
|
32
|
-
raw_data = example_row.raw_element
|
24
|
+
it 'can be parsed from stand alone text' do
|
25
|
+
source = '| a | row |'
|
33
26
|
|
34
|
-
|
35
|
-
expect(raw_data[:type]).to eq(:TableRow)
|
36
|
-
end
|
27
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
37
28
|
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
# Sanity check in case instantiation failed in a non-explosive manner
|
30
|
+
@element.cells.should == ['a', 'row']
|
31
|
+
end
|
41
32
|
|
42
|
-
|
43
|
-
|
44
|
-
end
|
33
|
+
it 'provides a descriptive filename when being parsed from stand alone text' do
|
34
|
+
source = " |bad |row| text| \n @foo "
|
45
35
|
|
46
|
-
|
47
|
-
|
48
|
-
raw_data = example_row.raw_element
|
36
|
+
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_row\.feature'/)
|
37
|
+
end
|
49
38
|
|
50
|
-
|
51
|
-
|
52
|
-
|
39
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
40
|
+
example_row = clazz.new("| a | row |")
|
41
|
+
raw_data = example_row.raw_element
|
53
42
|
|
43
|
+
expect(raw_data.keys).to match_array([:type, :location, :cells])
|
44
|
+
expect(raw_data[:type]).to eq(:TableRow)
|
45
|
+
end
|
54
46
|
|
55
|
-
|
56
|
-
|
57
|
-
|
47
|
+
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
48
|
+
example_row = clazz.new("| a | row |")
|
49
|
+
raw_data = example_row.raw_element
|
58
50
|
|
59
|
-
|
60
|
-
|
61
|
-
|
51
|
+
expect(raw_data.keys).to match_array([:type, :location, :cells])
|
52
|
+
expect(raw_data[:type]).to eq('TableRow')
|
53
|
+
end
|
62
54
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
@row.cells = :some_other_cells
|
67
|
-
@row.cells.should == :some_other_cells
|
68
|
-
end
|
55
|
+
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
56
|
+
example_row = clazz.new("| a | row |")
|
57
|
+
raw_data = example_row.raw_element
|
69
58
|
|
70
|
-
|
71
|
-
|
72
|
-
|
59
|
+
expect(raw_data.keys).to match_array(['cells', 'line', 'id'])
|
60
|
+
expect(raw_data['cells']).to eq(['a', 'row'])
|
61
|
+
end
|
73
62
|
|
74
|
-
|
63
|
+
it 'has cells' do
|
64
|
+
row.should respond_to(:cells)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'can change its cells' do
|
68
|
+
expect(row).to respond_to(:cells=)
|
69
|
+
|
70
|
+
row.cells = :some_cells
|
71
|
+
row.cells.should == :some_cells
|
72
|
+
row.cells = :some_other_cells
|
73
|
+
row.cells.should == :some_other_cells
|
74
|
+
end
|
75
75
|
|
76
|
-
it '
|
77
|
-
|
76
|
+
it 'starts with no cells' do
|
77
|
+
row.cells.should == []
|
78
78
|
end
|
79
79
|
|
80
|
-
|
81
|
-
|
80
|
+
describe 'row output edge cases' do
|
81
|
+
|
82
|
+
it 'is a String' do
|
83
|
+
row.to_s.should be_a(String)
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
context 'a new row object' do
|
88
|
+
|
89
|
+
let(:row) { clazz.new }
|
90
|
+
|
91
|
+
|
92
|
+
it 'can output an empty row' do
|
93
|
+
expect { row.to_s }.to_not raise_error
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
82
98
|
end
|
83
99
|
|
84
100
|
end
|
@@ -5,96 +5,110 @@ SimpleCov.command_name('Scenario') unless RUBY_VERSION.to_s < '1.9.0'
|
|
5
5
|
describe 'Scenario, Unit' do
|
6
6
|
|
7
7
|
let(:clazz) { CukeModeler::Scenario }
|
8
|
+
let(:scenario) { clazz.new }
|
8
9
|
|
9
|
-
it_should_behave_like 'a feature element'
|
10
|
-
it_should_behave_like 'a nested element'
|
11
|
-
it_should_behave_like 'a containing element'
|
12
|
-
it_should_behave_like 'a tagged element'
|
13
|
-
it_should_behave_like 'a bare bones element'
|
14
|
-
it_should_behave_like 'a prepopulated element'
|
15
|
-
it_should_behave_like 'a test element'
|
16
|
-
it_should_behave_like 'a sourced element'
|
17
|
-
it_should_behave_like 'a raw element'
|
18
10
|
|
19
|
-
|
20
|
-
source = 'Scenario: test scenario'
|
11
|
+
describe 'common behavior' do
|
21
12
|
|
22
|
-
|
13
|
+
it_should_behave_like 'a feature element'
|
14
|
+
it_should_behave_like 'a nested element'
|
15
|
+
it_should_behave_like 'a containing element'
|
16
|
+
it_should_behave_like 'a tagged element'
|
17
|
+
it_should_behave_like 'a bare bones element'
|
18
|
+
it_should_behave_like 'a prepopulated element'
|
19
|
+
it_should_behave_like 'a test element'
|
20
|
+
it_should_behave_like 'a sourced element'
|
21
|
+
it_should_behave_like 'a raw element'
|
23
22
|
|
24
|
-
# Sanity check in case instantiation failed in a non-explosive manner
|
25
|
-
@element.name.should == 'test scenario'
|
26
23
|
end
|
27
24
|
|
28
|
-
it 'provides a descriptive filename when being parsed from stand alone text' do
|
29
|
-
source = "bad scenario text \n Scenario:\n And a step\n @foo "
|
30
25
|
|
31
|
-
|
32
|
-
end
|
26
|
+
describe 'unique behavior' do
|
33
27
|
|
34
|
-
|
35
|
-
|
36
|
-
raw_data = scenario.raw_element
|
28
|
+
it 'can be parsed from stand alone text' do
|
29
|
+
source = 'Scenario: test scenario'
|
37
30
|
|
38
|
-
|
39
|
-
expect(raw_data[:type]).to eq(:Scenario)
|
40
|
-
end
|
31
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
41
32
|
|
42
|
-
|
43
|
-
|
44
|
-
|
33
|
+
# Sanity check in case instantiation failed in a non-explosive manner
|
34
|
+
@element.name.should == 'test scenario'
|
35
|
+
end
|
45
36
|
|
46
|
-
|
47
|
-
|
48
|
-
end
|
37
|
+
it 'provides a descriptive filename when being parsed from stand alone text' do
|
38
|
+
source = "bad scenario text \n Scenario:\n And a step\n @foo "
|
49
39
|
|
50
|
-
|
51
|
-
|
52
|
-
raw_data = scenario.raw_element
|
40
|
+
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_scenario\.feature'/)
|
41
|
+
end
|
53
42
|
|
54
|
-
|
55
|
-
|
56
|
-
|
43
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
44
|
+
scenario = clazz.new("Scenario: test scenario")
|
45
|
+
raw_data = scenario.raw_element
|
57
46
|
|
47
|
+
expect(raw_data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps])
|
48
|
+
expect(raw_data[:type]).to eq(:Scenario)
|
49
|
+
end
|
58
50
|
|
59
|
-
|
60
|
-
|
61
|
-
|
51
|
+
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
52
|
+
scenario = clazz.new("Scenario: test scenario")
|
53
|
+
raw_data = scenario.raw_element
|
62
54
|
|
63
|
-
|
64
|
-
|
65
|
-
|
55
|
+
expect(raw_data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps])
|
56
|
+
expect(raw_data[:type]).to eq(:Scenario)
|
57
|
+
end
|
66
58
|
|
67
|
-
|
59
|
+
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
60
|
+
scenario = clazz.new("Scenario: test scenario")
|
61
|
+
raw_data = scenario.raw_element
|
68
62
|
|
69
|
-
|
70
|
-
|
63
|
+
expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type'])
|
64
|
+
expect(raw_data['keyword']).to eq('Scenario')
|
65
|
+
end
|
71
66
|
|
72
|
-
|
67
|
+
it 'contains only steps' do
|
68
|
+
steps = [:step_1, :step_2]
|
69
|
+
everything = steps
|
73
70
|
|
74
|
-
|
75
|
-
@scenario.to_s.should be_a(String)
|
76
|
-
end
|
71
|
+
scenario.steps = steps
|
77
72
|
|
78
|
-
|
79
|
-
expect { @scenario.to_s }.to_not raise_error
|
73
|
+
scenario.contains.should =~ everything
|
80
74
|
end
|
81
75
|
|
82
|
-
|
83
|
-
@scenario.name = 'a name'
|
76
|
+
describe 'scenario output edge cases' do
|
84
77
|
|
85
|
-
|
86
|
-
|
78
|
+
it 'is a String' do
|
79
|
+
scenario.to_s.should be_a(String)
|
80
|
+
end
|
87
81
|
|
88
|
-
it 'can output a scenario that has only a description' do
|
89
|
-
@scenario.description_text = 'a description'
|
90
82
|
|
91
|
-
|
92
|
-
|
83
|
+
context 'a new scenario object' do
|
84
|
+
|
85
|
+
let(:scenario) { clazz.new }
|
86
|
+
|
87
|
+
|
88
|
+
it 'can output an empty scenario' do
|
89
|
+
expect { scenario.to_s }.to_not raise_error
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'can output a scenario that has only a name' do
|
93
|
+
scenario.name = 'a name'
|
94
|
+
|
95
|
+
expect { scenario.to_s }.to_not raise_error
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'can output a scenario that has only a description' do
|
99
|
+
scenario.description_text = 'a description'
|
100
|
+
|
101
|
+
expect { scenario.to_s }.to_not raise_error
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'can output a scenario that has only tags' do
|
105
|
+
scenario.tags = ['a tag']
|
106
|
+
|
107
|
+
expect { scenario.to_s }.to_not raise_error
|
108
|
+
end
|
93
109
|
|
94
|
-
|
95
|
-
@scenario.tags = ['a tag']
|
110
|
+
end
|
96
111
|
|
97
|
-
expect { @scenario.to_s }.to_not raise_error
|
98
112
|
end
|
99
113
|
|
100
114
|
end
|
@@ -4,14 +4,16 @@ SimpleCov.command_name('Sourceable') unless RUBY_VERSION.to_s < '1.9.0'
|
|
4
4
|
|
5
5
|
describe 'Sourceable, Unit' do
|
6
6
|
|
7
|
-
nodule
|
7
|
+
let(:nodule) { CukeModeler::Sourceable }
|
8
|
+
let(:element) { Object.new.extend(nodule) }
|
8
9
|
|
9
|
-
before(:each) do
|
10
|
-
@element = Object.new.extend(nodule)
|
11
|
-
end
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
describe 'unique behavior' do
|
12
|
+
|
13
|
+
it 'has a source line' do
|
14
|
+
element.should respond_to(:source_line)
|
15
|
+
end
|
16
|
+
|
15
17
|
end
|
16
18
|
|
17
19
|
end
|
@@ -4,17 +4,15 @@ shared_examples_for 'a sourced element' do
|
|
4
4
|
|
5
5
|
# clazz must be defined by the calling file
|
6
6
|
|
7
|
-
|
8
|
-
@element = clazz.new
|
9
|
-
end
|
7
|
+
let(:element) { clazz.new }
|
10
8
|
|
11
9
|
|
12
|
-
it 'has a source line
|
13
|
-
|
10
|
+
it 'has a source line' do
|
11
|
+
element.should respond_to(:source_line)
|
14
12
|
end
|
15
13
|
|
16
14
|
it 'starts with no source line' do
|
17
|
-
|
15
|
+
element.source_line.should == nil
|
18
16
|
end
|
19
17
|
|
20
18
|
end
|