cuke_modeler 2.1.0 → 3.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.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -1
  3. data/README.md +14 -16
  4. data/cuke_modeler.gemspec +33 -21
  5. data/lib/cuke_modeler.rb +2 -1
  6. data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +13 -0
  7. data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +13 -0
  8. data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +13 -0
  9. data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +13 -0
  10. data/lib/cuke_modeler/adapters/gherkin_14_adapter.rb +13 -0
  11. data/lib/cuke_modeler/adapters/gherkin_15_adapter.rb +13 -0
  12. data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +356 -4
  13. data/lib/cuke_modeler/containing.rb +41 -89
  14. data/lib/cuke_modeler/described.rb +40 -1
  15. data/lib/cuke_modeler/models/background.rb +12 -12
  16. data/lib/cuke_modeler/models/cell.rb +14 -8
  17. data/lib/cuke_modeler/models/comment.rb +6 -6
  18. data/lib/cuke_modeler/models/directory.rb +14 -18
  19. data/lib/cuke_modeler/models/doc_string.rb +11 -8
  20. data/lib/cuke_modeler/models/example.rb +64 -46
  21. data/lib/cuke_modeler/models/feature.rb +38 -20
  22. data/lib/cuke_modeler/models/feature_file.rb +6 -8
  23. data/lib/cuke_modeler/models/model.rb +2 -1
  24. data/lib/cuke_modeler/models/outline.rb +20 -15
  25. data/lib/cuke_modeler/models/row.rb +11 -8
  26. data/lib/cuke_modeler/models/rule.rb +101 -0
  27. data/lib/cuke_modeler/models/scenario.rb +18 -13
  28. data/lib/cuke_modeler/models/step.rb +41 -19
  29. data/lib/cuke_modeler/models/table.rb +10 -7
  30. data/lib/cuke_modeler/models/tag.rb +10 -6
  31. data/lib/cuke_modeler/named.rb +5 -1
  32. data/lib/cuke_modeler/nested.rb +22 -18
  33. data/lib/cuke_modeler/parsed.rb +8 -0
  34. data/lib/cuke_modeler/parsing.rb +55 -74
  35. data/lib/cuke_modeler/sourceable.rb +8 -0
  36. data/lib/cuke_modeler/stepped.rb +8 -0
  37. data/lib/cuke_modeler/taggable.rb +9 -1
  38. data/lib/cuke_modeler/version.rb +1 -1
  39. data/testing/cucumber/features/modeling/feature_modeling.feature +28 -7
  40. data/testing/cucumber/features/modeling/feature_output.feature +45 -23
  41. data/testing/cucumber/features/modeling/rule_modeling.feature +108 -0
  42. data/testing/cucumber/features/modeling/rule_output.feature +111 -0
  43. metadata +68 -161
  44. data/.gitignore +0 -18
  45. data/.simplecov +0 -7
  46. data/.travis.yml +0 -81
  47. data/Gemfile +0 -44
  48. data/Rakefile +0 -73
  49. data/appveyor.yml +0 -88
  50. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -274
  51. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -297
  52. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -309
  53. data/lib/cuke_modeler/adapters/gherkin_5_adapter.rb +0 -12
  54. data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +0 -310
  55. data/lib/cuke_modeler/adapters/gherkin_7_adapter.rb +0 -307
  56. data/lib/cuke_modeler/adapters/gherkin_8_adapter.rb +0 -12
  57. data/testing/cucumber/step_definitions/action_steps.rb +0 -13
  58. data/testing/cucumber/step_definitions/background_steps.rb +0 -1
  59. data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
  60. data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
  61. data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
  62. data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
  63. data/testing/cucumber/step_definitions/modeling_steps.rb +0 -49
  64. data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
  65. data/testing/cucumber/step_definitions/step_steps.rb +0 -3
  66. data/testing/cucumber/step_definitions/table_steps.rb +0 -1
  67. data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
  68. data/testing/cucumber/step_definitions/verification_steps.rb +0 -181
  69. data/testing/cucumber/support/env.rb +0 -30
  70. data/testing/dialect_helper.rb +0 -48
  71. data/testing/file_helper.rb +0 -47
  72. data/testing/gemfiles/gherkin2.gemfile +0 -33
  73. data/testing/gemfiles/gherkin3.gemfile +0 -26
  74. data/testing/gemfiles/gherkin4.gemfile +0 -27
  75. data/testing/gemfiles/gherkin5.gemfile +0 -27
  76. data/testing/gemfiles/gherkin6.gemfile +0 -10
  77. data/testing/gemfiles/gherkin7.gemfile +0 -9
  78. data/testing/gemfiles/gherkin8.gemfile +0 -9
  79. data/testing/gemfiles/gherkin9.gemfile +0 -9
  80. data/testing/helper_methods.rb +0 -23
  81. data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +0 -166
  82. data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +0 -166
  83. data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +0 -165
  84. data/testing/rspec/spec/integration/adapters/gherkin_5_adapter_spec.rb +0 -165
  85. data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +0 -159
  86. data/testing/rspec/spec/integration/adapters/gherkin_7_adapter_spec.rb +0 -162
  87. data/testing/rspec/spec/integration/adapters/gherkin_8_adapter_spec.rb +0 -162
  88. data/testing/rspec/spec/integration/adapters/gherkin_9_adapter_spec.rb +0 -162
  89. data/testing/rspec/spec/integration/models/background_integration_spec.rb +0 -438
  90. data/testing/rspec/spec/integration/models/cell_integration_spec.rb +0 -338
  91. data/testing/rspec/spec/integration/models/comment_integration_spec.rb +0 -180
  92. data/testing/rspec/spec/integration/models/directory_integration_spec.rb +0 -218
  93. data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +0 -398
  94. data/testing/rspec/spec/integration/models/example_integration_spec.rb +0 -753
  95. data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +0 -276
  96. data/testing/rspec/spec/integration/models/feature_integration_spec.rb +0 -655
  97. data/testing/rspec/spec/integration/models/model_integration_spec.rb +0 -15
  98. data/testing/rspec/spec/integration/models/outline_integration_spec.rb +0 -619
  99. data/testing/rspec/spec/integration/models/row_integration_spec.rb +0 -303
  100. data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +0 -475
  101. data/testing/rspec/spec/integration/models/step_integration_spec.rb +0 -573
  102. data/testing/rspec/spec/integration/models/table_integration_spec.rb +0 -333
  103. data/testing/rspec/spec/integration/models/tag_integration_spec.rb +0 -271
  104. data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
  105. data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -143
  106. data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
  107. data/testing/rspec/spec/spec_helper.rb +0 -129
  108. data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +0 -25
  109. data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
  110. data/testing/rspec/spec/unit/models/background_unit_spec.rb +0 -83
  111. data/testing/rspec/spec/unit/models/cell_unit_spec.rb +0 -68
  112. data/testing/rspec/spec/unit/models/comment_unit_spec.rb +0 -68
  113. data/testing/rspec/spec/unit/models/directory_unit_spec.rb +0 -127
  114. data/testing/rspec/spec/unit/models/doc_string_unit_spec.rb +0 -100
  115. data/testing/rspec/spec/unit/models/example_unit_spec.rb +0 -133
  116. data/testing/rspec/spec/unit/models/feature_file_unit_spec.rb +0 -125
  117. data/testing/rspec/spec/unit/models/feature_unit_spec.rb +0 -157
  118. data/testing/rspec/spec/unit/models/model_unit_spec.rb +0 -15
  119. data/testing/rspec/spec/unit/models/outline_unit_spec.rb +0 -117
  120. data/testing/rspec/spec/unit/models/row_unit_spec.rb +0 -68
  121. data/testing/rspec/spec/unit/models/scenario_unit_spec.rb +0 -86
  122. data/testing/rspec/spec/unit/models/step_unit_spec.rb +0 -109
  123. data/testing/rspec/spec/unit/models/table_unit_spec.rb +0 -77
  124. data/testing/rspec/spec/unit/models/tag_unit_spec.rb +0 -68
  125. data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
  126. data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
  127. data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
  128. data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
  129. data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
  130. data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -127
  131. data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
  132. data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
  133. data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
  134. data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
  135. data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
  136. data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
  137. data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
  138. data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
  139. data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
  140. data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
  141. data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
  142. data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
  143. data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
  144. data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
  145. data/testing/test_languages.json +0 -45
  146. data/todo.txt +0 -25
@@ -1,91 +0,0 @@
1
- require "#{File.dirname(__FILE__)}/../spec_helper"
2
-
3
-
4
- describe 'Nested, Integration' do
5
-
6
- let(:nodule) { CukeModeler::Nested }
7
- let(:nested_model) { Object.new.extend(nodule) }
8
-
9
-
10
- describe 'unique behavior' do
11
-
12
- describe 'an object including the module' do
13
-
14
- describe 'getting ancestors' do
15
-
16
- context 'with a background ancestor' do
17
-
18
- let(:background) { CukeModeler::Background.new }
19
-
20
- before(:each) do
21
- nested_model.parent_model = background
22
- end
23
-
24
-
25
- it "will find its background as a 'test' ancestor" do
26
- ancestor = nested_model.get_ancestor(:test)
27
-
28
- expect(ancestor).to equal(background)
29
- end
30
-
31
- it "will find its background as a 'background' ancestor" do
32
- ancestor = nested_model.get_ancestor(:background)
33
-
34
- expect(ancestor).to equal(background)
35
- end
36
-
37
- end
38
-
39
- context 'with a scenario ancestor' do
40
-
41
- let(:scenario) { CukeModeler::Scenario.new }
42
-
43
- before(:each) do
44
- nested_model.parent_model = scenario
45
- end
46
-
47
-
48
- it "will find its scenario as a 'test' ancestor" do
49
- ancestor = nested_model.get_ancestor(:test)
50
-
51
- expect(ancestor).to equal(scenario)
52
- end
53
-
54
- it "will find its scenario as a 'scenario' ancestor" do
55
- ancestor = nested_model.get_ancestor(:scenario)
56
-
57
- expect(ancestor).to equal(scenario)
58
- end
59
-
60
- end
61
-
62
- context 'with an outline ancestor' do
63
-
64
- let(:outline) { CukeModeler::Outline.new }
65
-
66
- before(:each) do
67
- nested_model.parent_model = outline
68
- end
69
-
70
-
71
- it "will find its outline as a 'test' ancestor" do
72
- ancestor = nested_model.get_ancestor(:test)
73
-
74
- expect(ancestor).to equal(outline)
75
- end
76
-
77
- it "will find its outline as a 'outline' ancestor" do
78
- ancestor = nested_model.get_ancestor(:outline)
79
-
80
- expect(ancestor).to equal(outline)
81
- end
82
-
83
- end
84
-
85
- end
86
-
87
- end
88
-
89
- end
90
-
91
- end
@@ -1,143 +0,0 @@
1
- require "#{File.dirname(__FILE__)}/../spec_helper"
2
-
3
-
4
- describe 'Parsing, Integration' do
5
-
6
- let(:nodule) { CukeModeler::Parsing }
7
-
8
-
9
- describe 'unique behavior' do
10
-
11
- it 'will complain if using an unknown version of `gherkin`' do
12
- original_version = Gem.loaded_specs['gherkin'].version
13
- unknown_version = Gem::Version.new('0.0.0')
14
-
15
- begin
16
- Gem.loaded_specs['gherkin'].instance_variable_set(:@version, unknown_version)
17
-
18
- expect { load "#{File.dirname(__FILE__)}/../../../../lib/cuke_modeler/parsing.rb" }.to raise_error("Unknown Gherkin version: '0.0.0'")
19
- ensure
20
- Gem.loaded_specs['gherkin'].instance_variable_set(:@version, original_version)
21
- end
22
- end
23
-
24
- it 'loads the correct dialects based on the version of Gherkin used', :unless => gherkin?(2) do
25
- expect(nodule.dialects).to equal(Gherkin::DIALECTS)
26
- end
27
-
28
- it 'loads the correct dialects based on the version of Gherkin used', :if => gherkin?(2) do
29
- expect(nodule.dialects).to equal(Gherkin::I18n::LANGUAGES)
30
- end
31
-
32
- it 'can parse text that uses a non-default dialect' do
33
- source_text = "# language: en-au
34
- Pretty much:
35
-
36
- First off:
37
- Y'know foo
38
-
39
- Awww, look mate:
40
- It's just unbelievable that zip
41
- But at the end of the day I reckon bar
42
-
43
- Reckon it's like:
44
- Yeah nah zen
45
- Too right baz
46
- You'll wanna:
47
- | param |
48
- | value |"
49
-
50
- expect { nodule.parse_text(source_text) }.to_not raise_error
51
- end
52
-
53
- it 'raises and error if given something to parse besides a string' do
54
- expect { nodule.parse_text(5) }.to raise_error(ArgumentError, /Text to parse must be a String but got/)
55
- expect { nodule.parse_text("#{FEATURE_KEYWORD}:") }.to_not raise_error
56
- end
57
-
58
- it 'includes the type of object provided when raising an non-string exception' do
59
- expect { nodule.parse_text(:not_a_string) }.to raise_error(ArgumentError, /Symbol/)
60
- end
61
-
62
- # todo - Stop doing this. Just return a feature file rooted AST. (Will require major version number change)
63
- it 'returns an Array' do
64
- result = nodule.parse_text("#{FEATURE_KEYWORD}:")
65
- expect(result).to be_a(Array)
66
- end
67
-
68
- it 'raises an error if an error is encountered while parsing text' do
69
- expect { nodule.parse_text('bad file') }.to raise_error(ArgumentError, /Error encountered while parsing '.*'/)
70
- end
71
-
72
- it 'includes the file parsed in the error that it raises' do
73
- expect { nodule.parse_text('bad file', 'file foo.txt') }.to raise_error(/'file foo\.txt'/)
74
- end
75
-
76
- it 'has a default file name used while parsing if one is not provided' do
77
- expect { nodule.parse_text('bad file') }.to raise_error(ArgumentError, /'cuke_modeler_fake_file\.feature'/)
78
- end
79
-
80
- it 'includes the underlying error message in the error that it raises' do
81
- begin
82
- $old_method = CukeModeler::Parsing.method(:parsing_method)
83
-
84
- # Custom error type in order to ensure that we are throwing the correct thing
85
- module CukeModeler
86
- class TestError < StandardError
87
- end
88
- end
89
-
90
- # Monkey patch the parsing method to throw the error that we need for testing
91
- module CukeModeler
92
- module Parsing
93
- class << self
94
- def parsing_method(*args)
95
- raise(CukeModeler::TestError, 'something went wrong')
96
- end
97
- end
98
- end
99
- end
100
-
101
-
102
- expect { nodule.parse_text('bad file') }.to raise_error(/CukeModeler::TestError.*something went wrong/)
103
- ensure
104
- # Making sure that our changes don't escape a test and ruin the rest of the suite
105
- module CukeModeler
106
- module Parsing
107
- class << self
108
- define_method(:parsing_method, $old_method)
109
- end
110
- end
111
- end
112
- end
113
-
114
- end
115
-
116
- describe 'parsing invalid Gherkin' do
117
-
118
- it 'correctly bubbles up parsing errors', :if => gherkin?(6, 7, 8, 9) do
119
- expect { nodule.parse_text('bad file') }.to raise_error(/RuntimeError.*#EOF/)
120
- end
121
-
122
- it 'correctly bubbles up parsing errors', :if => gherkin?(4, 5) do
123
- expect { nodule.parse_text('bad file') }.to raise_error(/Gherkin::CompositeParserException.*#EOF/m)
124
- end
125
-
126
- it 'correctly bubbles up parsing errors', :if => gherkin?(3) do
127
- expect { nodule.parse_text('bad file') }.to raise_error(/Gherkin::CompositeParserException.*unexpected end of file/m)
128
- end
129
-
130
- it 'correctly bubbles up parsing errors', :if => gherkin?(2) do
131
- # A different error is thrown on JRuby
132
- if RUBY_PLATFORM == "java"
133
- expect { nodule.parse_text('bad file') }.to raise_error(/Java::GherkinLexer.*_FEATURE_END_/m)
134
- else
135
- expect { nodule.parse_text('bad file') }.to raise_error(/Gherkin::Lexer::LexingError.*error on line 1/)
136
- end
137
- end
138
-
139
- end
140
-
141
- end
142
-
143
- end
@@ -1,18 +0,0 @@
1
- require "#{File.dirname(__FILE__)}/../../spec_helper"
2
-
3
- shared_examples_for 'a model, integration' do
4
-
5
- # clazz must be defined by the calling file
6
-
7
- let(:model) { clazz.new }
8
-
9
-
10
- describe 'unique behavior' do
11
-
12
- it 'inherits from the common model class' do
13
- expect(model).to be_a(CukeModeler::Model)
14
- end
15
-
16
- end
17
-
18
- end
@@ -1,129 +0,0 @@
1
- unless RUBY_VERSION.to_s < '1.9.0'
2
- require 'simplecov'
3
- SimpleCov.command_name('rspec_tests')
4
- end
5
-
6
-
7
- # Ruby 1.8.x seems to have trouble if relative paths get too nested, so resolving the path before using it here
8
- this_dir = File.expand_path(File.dirname(__FILE__))
9
- require "#{this_dir}/../../../lib/cuke_modeler"
10
-
11
- require "#{this_dir}/unit/shared/models_unit_specs"
12
- require "#{this_dir}/integration/shared/models_integration_specs"
13
- require "#{this_dir}/unit/shared/named_models_unit_specs"
14
- require "#{this_dir}/unit/shared/described_models_unit_specs"
15
- require "#{this_dir}/unit/shared/stepped_models_unit_specs"
16
- require "#{this_dir}/unit/shared/stringifiable_models_unit_specs"
17
- require "#{this_dir}/unit/shared/nested_models_unit_specs"
18
- require "#{this_dir}/unit/shared/tagged_models_unit_specs"
19
- require "#{this_dir}/unit/shared/containing_models_unit_specs"
20
- require "#{this_dir}/unit/shared/bare_bones_models_unit_specs"
21
- require "#{this_dir}/unit/shared/prepopulated_models_unit_specs"
22
- require "#{this_dir}/unit/shared/sourced_models_unit_specs"
23
- require "#{this_dir}/unit/shared/parsed_models_unit_specs"
24
- require "#{this_dir}/unit/shared/keyworded_models_unit_specs"
25
-
26
- require "#{this_dir}/../../dialect_helper"
27
- require "#{this_dir}/../../file_helper"
28
- require "#{this_dir}/../../helper_methods"
29
-
30
- require 'rubygems/mock_gem_ui'
31
-
32
-
33
- # Use a random dialect for testing in order to avoid hard coded language assumptions in the
34
- # implementation and making the test dialect the default dialect so that language headers
35
- # aren't needed for all of the test code. Only possible with some versions of Gherkin.
36
-
37
- gherkin_major_version = Gem.loaded_specs['gherkin'].version.version.match(/^(\d+)\./)[1].to_i
38
-
39
- case gherkin_major_version
40
- when 8, 9
41
- # TODO: choose randomly from Gherkin::DIALECTS once I figure out how to handle encodings...
42
- test_dialect = ['en', 'en-lol', 'en-pirate', 'en-Scouse'].sample
43
- puts "Testing with dialect '#{test_dialect}'..."
44
-
45
- CukeModeler::DialectHelper.set_dialect(Gherkin::DIALECTS[test_dialect])
46
- CukeModeler::Parsing.dialect = test_dialect
47
-
48
- module Gherkin
49
- class << self
50
- alias_method :original_from_source, :from_source
51
-
52
- def from_source(uri, data, options = {})
53
- options[:default_dialect] ||= CukeModeler::Parsing.dialect
54
- original_from_source(uri, data, options)
55
- end
56
- end
57
- end
58
- when 6, 7
59
- # TODO: choose randomly from Gherkin::DIALECTS once I figure out how to handle encodings...
60
- test_dialect = ['en', 'en-lol', 'en-pirate', 'en-Scouse'].sample
61
- puts "Testing with dialect '#{test_dialect}'..."
62
-
63
- CukeModeler::DialectHelper.set_dialect(Gherkin::DIALECTS[test_dialect])
64
- CukeModeler::Parsing.dialect = test_dialect
65
-
66
- module Gherkin
67
- class Gherkin
68
- class << self
69
- alias_method :original_from_source, :from_source
70
-
71
- def from_source(uri, data, options = {})
72
- options[:default_dialect] ||= CukeModeler::Parsing.dialect
73
- original_from_source(uri, data, options)
74
- end
75
- end
76
- end
77
- end
78
- when 3, 4, 5
79
- # TODO: stop using test dialect and just randomize for all version of `gherkin`
80
- dialect_file_path = "#{this_dir}/../../test_languages.json"
81
- test_dialects = JSON.parse File.open(dialect_file_path, 'r:UTF-8').read
82
-
83
- Gherkin::DIALECTS.merge!(test_dialects)
84
-
85
-
86
- module Gherkin
87
- class Parser
88
-
89
- alias_method :original_parse, :parse
90
-
91
- def parse(token_scanner, token_matcher = TokenMatcher.new('cm-test'))
92
- original_parse(token_scanner, token_matcher)
93
- end
94
-
95
- end
96
- end
97
-
98
- CukeModeler::DialectHelper.set_dialect(test_dialects['cm-test'])
99
- CukeModeler::Parsing.dialect = 'cm-test'
100
- when 2
101
- CukeModeler::DialectHelper.set_dialect(Gherkin::I18n::LANGUAGES['en'])
102
- CukeModeler::Parsing.dialect = 'en'
103
- else
104
- raise("Unknown Gherkin major version: '#{gherkin_major_version}'")
105
- end
106
-
107
-
108
- RSpec.configure do |config|
109
-
110
- include CukeModeler::HelperMethods
111
-
112
- config.before(:suite) do
113
- FEATURE_KEYWORD = CukeModeler::DialectHelper.feature_keyword
114
- BACKGROUND_KEYWORD = CukeModeler::DialectHelper.background_keyword
115
- SCENARIO_KEYWORD = CukeModeler::DialectHelper.scenario_keyword
116
- OUTLINE_KEYWORD = CukeModeler::DialectHelper.outline_keyword
117
- EXAMPLE_KEYWORD = CukeModeler::DialectHelper.example_keyword
118
- STEP_KEYWORD = CukeModeler::DialectHelper.step_keyword
119
- GIVEN_KEYWORD = CukeModeler::DialectHelper.given_keyword
120
- THEN_KEYWORD = CukeModeler::DialectHelper.then_keyword
121
- end
122
-
123
- config.after(:suite) do
124
- CukeModeler::FileHelper.created_directories.each do |dir_path|
125
- FileUtils.remove_entry(dir_path, true)
126
- end
127
- end
128
-
129
- end
@@ -1,25 +0,0 @@
1
- require "#{File.dirname(__FILE__)}/../spec_helper"
2
-
3
-
4
- describe 'the gem' do
5
-
6
- let(:gemspec) { eval(File.read "#{File.dirname(__FILE__)}/../../../../cuke_modeler.gemspec") }
7
-
8
-
9
- it 'validates cleanly' do
10
- mock_ui = Gem::MockGemUi.new
11
- Gem::DefaultUserInteraction.use_ui(mock_ui) { gemspec.validate }
12
-
13
- expect(mock_ui.error).to_not match(/warn/i)
14
- end
15
-
16
- end
17
-
18
-
19
- describe CukeModeler do
20
-
21
- it "has a version number" do
22
- expect(CukeModeler::VERSION).not_to be nil
23
- end
24
-
25
- end
@@ -1,23 +0,0 @@
1
- require "#{File.dirname(__FILE__)}/../spec_helper"
2
-
3
-
4
- describe 'Described, Unit', :unit_test => true do
5
-
6
- let(:nodule) { CukeModeler::Described }
7
- let(:described_model) { Object.new.extend(nodule) }
8
-
9
-
10
- it 'has a description' do
11
- expect(described_model).to respond_to(:description)
12
- end
13
-
14
- it 'can change its description' do
15
- expect(described_model).to respond_to(:description=)
16
-
17
- described_model.description = :some_description
18
- expect(described_model.description).to eq(:some_description)
19
- described_model.description = :some_other_description
20
- expect(described_model.description).to eq(:some_other_description)
21
- end
22
-
23
- end
@@ -1,83 +0,0 @@
1
- require "#{File.dirname(__FILE__)}/../../spec_helper"
2
-
3
-
4
- describe 'Background, Unit', :unit_test => true do
5
-
6
- let(:clazz) { CukeModeler::Background }
7
- let(:background) { clazz.new }
8
-
9
-
10
- describe 'common behavior' do
11
-
12
- it_should_behave_like 'a model'
13
- it_should_behave_like 'a keyworded model'
14
- it_should_behave_like 'a named model'
15
- it_should_behave_like 'a described model'
16
- it_should_behave_like 'a stepped model'
17
- it_should_behave_like 'a sourced model'
18
- it_should_behave_like 'a parsed model'
19
-
20
- end
21
-
22
-
23
- describe 'unique behavior' do
24
-
25
- it 'contains steps' do
26
- steps = [:step_1, :step_2]
27
- everything = steps
28
-
29
- background.steps = steps
30
-
31
- expect(background.children).to match_array(everything)
32
- end
33
-
34
-
35
- describe 'comparison' do
36
-
37
- it 'can gracefully be compared to other types of objects' do
38
- # Some common types of object
39
- [1, 'foo', :bar, [], {}].each do |thing|
40
- expect { background == thing }.to_not raise_error
41
- expect(background == thing).to be false
42
- end
43
- end
44
-
45
- end
46
-
47
-
48
- describe 'background output' do
49
-
50
- context 'from abstract instantiation' do
51
-
52
- let(:background) { clazz.new }
53
-
54
-
55
- it 'can output an empty background' do
56
- expect { background.to_s }.to_not raise_error
57
- end
58
-
59
- it 'can output a background that has only a keyword' do
60
- background.keyword = 'foo'
61
-
62
- expect(background.to_s).to eq('foo:')
63
- end
64
-
65
- it 'can output a background that has only a name' do
66
- background.name = 'a name'
67
-
68
- expect { background.to_s }.to_not raise_error
69
- end
70
-
71
- it 'can output a background that has only a description' do
72
- background.description = 'a description'
73
-
74
- expect { background.to_s }.to_not raise_error
75
- end
76
-
77
- end
78
-
79
- end
80
-
81
- end
82
-
83
- end