cuke_modeler 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +5 -0
  3. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +77 -22
  4. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +25 -1
  5. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +25 -1
  6. data/lib/cuke_modeler/containing.rb +15 -0
  7. data/lib/cuke_modeler/models/background.rb +1 -1
  8. data/lib/cuke_modeler/models/cell.rb +1 -1
  9. data/lib/cuke_modeler/models/comment.rb +47 -0
  10. data/lib/cuke_modeler/models/directory.rb +2 -5
  11. data/lib/cuke_modeler/models/doc_string.rb +1 -1
  12. data/lib/cuke_modeler/models/example.rb +1 -1
  13. data/lib/cuke_modeler/models/feature.rb +1 -1
  14. data/lib/cuke_modeler/models/feature_file.rb +8 -5
  15. data/lib/cuke_modeler/models/outline.rb +1 -1
  16. data/lib/cuke_modeler/models/row.rb +1 -1
  17. data/lib/cuke_modeler/models/scenario.rb +1 -1
  18. data/lib/cuke_modeler/models/step.rb +1 -1
  19. data/lib/cuke_modeler/models/table.rb +1 -1
  20. data/lib/cuke_modeler/models/tag.rb +1 -1
  21. data/lib/cuke_modeler/version.rb +1 -1
  22. data/lib/cuke_modeler.rb +1 -0
  23. data/testing/cucumber/features/modeling/comment_modeling.feature +43 -0
  24. data/testing/cucumber/features/modeling/comment_output.feature +27 -0
  25. data/testing/cucumber/features/modeling/feature_file_modeling.feature +11 -0
  26. data/testing/cucumber/features/modeling/model_structure.feature +2 -2
  27. data/testing/cucumber/features/modeling/tag_output.feature +1 -1
  28. data/testing/cucumber/step_definitions/feature_file_steps.rb +10 -0
  29. data/testing/cucumber/step_definitions/setup_steps.rb +6 -0
  30. data/testing/cucumber/step_definitions/verification_steps.rb +7 -1
  31. data/testing/rspec/spec/integration/comment_integration_spec.rb +168 -0
  32. data/testing/rspec/spec/integration/feature_file_integration_spec.rb +124 -0
  33. data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +36 -3
  34. data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +28 -4
  35. data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +28 -3
  36. data/testing/rspec/spec/integration/parsing_integration_spec.rb +1 -0
  37. data/testing/rspec/spec/unit/comment_unit_spec.rb +74 -0
  38. data/testing/rspec/spec/unit/feature_file_unit_spec.rb +18 -0
  39. data/todo.txt +2 -0
  40. metadata +7 -2
@@ -0,0 +1,74 @@
1
+ require "#{File.dirname(__FILE__)}/../spec_helper"
2
+
3
+
4
+ describe 'Comment, Unit', :unit_test => true do
5
+
6
+ let(:clazz) { CukeModeler::Comment }
7
+ let(:model) { clazz.new }
8
+
9
+
10
+ describe 'common behavior' do
11
+
12
+ it_should_behave_like 'a model'
13
+ it_should_behave_like 'a sourced model'
14
+ it_should_behave_like 'a parsed model'
15
+
16
+ end
17
+
18
+
19
+ describe 'unique behavior' do
20
+
21
+ it 'has text' do
22
+ expect(model).to respond_to(:text)
23
+ end
24
+
25
+ it 'can change its text' do
26
+ expect(model).to respond_to(:text=)
27
+
28
+ model.text = :some_text
29
+ expect(model.text).to eq(:some_text)
30
+ model.text = :some_other_text
31
+ expect(model.text).to eq(:some_other_text)
32
+ end
33
+
34
+
35
+ describe 'abstract instantiation' do
36
+
37
+ context 'a new comment object' do
38
+
39
+ let(:comment) { clazz.new }
40
+
41
+
42
+ it 'starts with no text' do
43
+ expect(comment.text).to be_nil
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+
52
+
53
+ describe 'comment output' do
54
+
55
+ # todo - remove these tests because they are covered by the stringifiable tests
56
+ it 'is a String' do
57
+ expect(model.to_s).to be_a(String)
58
+ end
59
+
60
+
61
+ context 'from abstract instantiation' do
62
+
63
+ let(:comment) { clazz.new }
64
+
65
+
66
+ it 'can output an empty comment' do
67
+ expect { comment.to_s }.to_not raise_error
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+
74
+ end
@@ -10,6 +10,7 @@ describe 'FeatureFile, Unit', :unit_test => true do
10
10
  describe 'common behavior' do
11
11
 
12
12
  it_should_behave_like 'a model'
13
+ it_should_behave_like 'a parsed model'
13
14
 
14
15
  end
15
16
 
@@ -42,6 +43,19 @@ describe 'FeatureFile, Unit', :unit_test => true do
42
43
  expect(feature_file.feature).to eq(:some_other_features)
43
44
  end
44
45
 
46
+ it 'has comments' do
47
+ expect(feature_file).to respond_to(:comments)
48
+ end
49
+
50
+ it 'can change its comments' do
51
+ expect(feature_file).to respond_to(:comments=)
52
+
53
+ feature_file.comments = :some_comments
54
+ expect(feature_file.comments).to eq(:some_comments)
55
+ feature_file.comments = :some_other_comments
56
+ expect(feature_file.comments).to eq(:some_other_comments)
57
+ end
58
+
45
59
  it 'knows the name of the file that it is modeling' do
46
60
  expect(feature_file).to respond_to(:name)
47
61
  end
@@ -73,6 +87,10 @@ describe 'FeatureFile, Unit', :unit_test => true do
73
87
  expect(feature_file.feature).to be_nil
74
88
  end
75
89
 
90
+ it 'starts with no comments' do
91
+ expect(feature_file.comments).to eq([])
92
+ end
93
+
76
94
  end
77
95
 
78
96
  end
data/todo.txt CHANGED
@@ -15,6 +15,8 @@ document helper modules as not part of the public API
15
15
  Backlog
16
16
  -------------
17
17
 
18
+ Include comments in the string output of a feature file
19
+
18
20
  replace joined array source text with single string source text/heredocs
19
21
  Don't bother to test directory create/destroy around unit tests
20
22
  unit testing around parsing/modeling cases (whitespace, indentation, minimalistic feature elements, etc.)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke_modeler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kessler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-28 00:00:00.000000000 Z
11
+ date: 2016-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gherkin
@@ -185,6 +185,7 @@ files:
185
185
  - lib/cuke_modeler/described.rb
186
186
  - lib/cuke_modeler/models/background.rb
187
187
  - lib/cuke_modeler/models/cell.rb
188
+ - lib/cuke_modeler/models/comment.rb
188
189
  - lib/cuke_modeler/models/directory.rb
189
190
  - lib/cuke_modeler/models/doc_string.rb
190
191
  - lib/cuke_modeler/models/example.rb
@@ -210,6 +211,8 @@ files:
210
211
  - testing/cucumber/features/modeling/background_output.feature
211
212
  - testing/cucumber/features/modeling/cell_modeling.feature
212
213
  - testing/cucumber/features/modeling/cell_output.feature
214
+ - testing/cucumber/features/modeling/comment_modeling.feature
215
+ - testing/cucumber/features/modeling/comment_output.feature
213
216
  - testing/cucumber/features/modeling/directory_modeling.feature
214
217
  - testing/cucumber/features/modeling/directory_output.feature
215
218
  - testing/cucumber/features/modeling/doc_string_modeling.feature
@@ -254,6 +257,7 @@ files:
254
257
  - testing/gemfiles/gherkin4.gemfile
255
258
  - testing/rspec/spec/integration/background_integration_spec.rb
256
259
  - testing/rspec/spec/integration/cell_integration_spec.rb
260
+ - testing/rspec/spec/integration/comment_integration_spec.rb
257
261
  - testing/rspec/spec/integration/directory_integration_spec.rb
258
262
  - testing/rspec/spec/integration/doc_string_integration_spec.rb
259
263
  - testing/rspec/spec/integration/example_integration_spec.rb
@@ -275,6 +279,7 @@ files:
275
279
  - testing/rspec/spec/spec_helper.rb
276
280
  - testing/rspec/spec/unit/background_unit_spec.rb
277
281
  - testing/rspec/spec/unit/cell_unit_spec.rb
282
+ - testing/rspec/spec/unit/comment_unit_spec.rb
278
283
  - testing/rspec/spec/unit/described_unit_spec.rb
279
284
  - testing/rspec/spec/unit/directory_unit_spec.rb
280
285
  - testing/rspec/spec/unit/doc_string_unit_spec.rb