cuke_modeler 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -1
  3. data/README.md +11 -14
  4. data/cuke_modeler.gemspec +12 -9
  5. data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +12 -0
  6. data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +12 -0
  7. data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +12 -0
  8. data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +12 -0
  9. data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +313 -5
  10. data/lib/cuke_modeler/models/background.rb +1 -1
  11. data/lib/cuke_modeler/models/cell.rb +1 -1
  12. data/lib/cuke_modeler/models/comment.rb +1 -1
  13. data/lib/cuke_modeler/models/directory.rb +2 -2
  14. data/lib/cuke_modeler/models/doc_string.rb +1 -1
  15. data/lib/cuke_modeler/models/example.rb +1 -1
  16. data/lib/cuke_modeler/models/feature.rb +1 -1
  17. data/lib/cuke_modeler/models/feature_file.rb +2 -2
  18. data/lib/cuke_modeler/models/outline.rb +1 -1
  19. data/lib/cuke_modeler/models/row.rb +1 -1
  20. data/lib/cuke_modeler/models/scenario.rb +1 -1
  21. data/lib/cuke_modeler/models/step.rb +1 -1
  22. data/lib/cuke_modeler/models/table.rb +1 -1
  23. data/lib/cuke_modeler/models/tag.rb +1 -1
  24. data/lib/cuke_modeler/parsing.rb +29 -58
  25. data/lib/cuke_modeler/version.rb +1 -1
  26. metadata +33 -151
  27. data/.gitignore +0 -18
  28. data/.simplecov +0 -7
  29. data/.travis.yml +0 -81
  30. data/Gemfile +0 -44
  31. data/Rakefile +0 -73
  32. data/appveyor.yml +0 -88
  33. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -274
  34. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -297
  35. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -309
  36. data/lib/cuke_modeler/adapters/gherkin_5_adapter.rb +0 -12
  37. data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +0 -310
  38. data/lib/cuke_modeler/adapters/gherkin_7_adapter.rb +0 -307
  39. data/lib/cuke_modeler/adapters/gherkin_8_adapter.rb +0 -12
  40. data/testing/cucumber/step_definitions/action_steps.rb +0 -13
  41. data/testing/cucumber/step_definitions/background_steps.rb +0 -1
  42. data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
  43. data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
  44. data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
  45. data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
  46. data/testing/cucumber/step_definitions/modeling_steps.rb +0 -49
  47. data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
  48. data/testing/cucumber/step_definitions/step_steps.rb +0 -3
  49. data/testing/cucumber/step_definitions/table_steps.rb +0 -1
  50. data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
  51. data/testing/cucumber/step_definitions/verification_steps.rb +0 -181
  52. data/testing/cucumber/support/env.rb +0 -30
  53. data/testing/dialect_helper.rb +0 -48
  54. data/testing/file_helper.rb +0 -47
  55. data/testing/gemfiles/gherkin2.gemfile +0 -33
  56. data/testing/gemfiles/gherkin3.gemfile +0 -26
  57. data/testing/gemfiles/gherkin4.gemfile +0 -27
  58. data/testing/gemfiles/gherkin5.gemfile +0 -27
  59. data/testing/gemfiles/gherkin6.gemfile +0 -10
  60. data/testing/gemfiles/gherkin7.gemfile +0 -9
  61. data/testing/gemfiles/gherkin8.gemfile +0 -9
  62. data/testing/gemfiles/gherkin9.gemfile +0 -9
  63. data/testing/helper_methods.rb +0 -23
  64. data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +0 -166
  65. data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +0 -166
  66. data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +0 -165
  67. data/testing/rspec/spec/integration/adapters/gherkin_5_adapter_spec.rb +0 -165
  68. data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +0 -159
  69. data/testing/rspec/spec/integration/adapters/gherkin_7_adapter_spec.rb +0 -162
  70. data/testing/rspec/spec/integration/adapters/gherkin_8_adapter_spec.rb +0 -162
  71. data/testing/rspec/spec/integration/adapters/gherkin_9_adapter_spec.rb +0 -162
  72. data/testing/rspec/spec/integration/models/background_integration_spec.rb +0 -438
  73. data/testing/rspec/spec/integration/models/cell_integration_spec.rb +0 -338
  74. data/testing/rspec/spec/integration/models/comment_integration_spec.rb +0 -180
  75. data/testing/rspec/spec/integration/models/directory_integration_spec.rb +0 -218
  76. data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +0 -398
  77. data/testing/rspec/spec/integration/models/example_integration_spec.rb +0 -753
  78. data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +0 -276
  79. data/testing/rspec/spec/integration/models/feature_integration_spec.rb +0 -655
  80. data/testing/rspec/spec/integration/models/model_integration_spec.rb +0 -15
  81. data/testing/rspec/spec/integration/models/outline_integration_spec.rb +0 -619
  82. data/testing/rspec/spec/integration/models/row_integration_spec.rb +0 -303
  83. data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +0 -475
  84. data/testing/rspec/spec/integration/models/step_integration_spec.rb +0 -573
  85. data/testing/rspec/spec/integration/models/table_integration_spec.rb +0 -333
  86. data/testing/rspec/spec/integration/models/tag_integration_spec.rb +0 -271
  87. data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
  88. data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -143
  89. data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
  90. data/testing/rspec/spec/spec_helper.rb +0 -129
  91. data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +0 -25
  92. data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
  93. data/testing/rspec/spec/unit/models/background_unit_spec.rb +0 -83
  94. data/testing/rspec/spec/unit/models/cell_unit_spec.rb +0 -68
  95. data/testing/rspec/spec/unit/models/comment_unit_spec.rb +0 -68
  96. data/testing/rspec/spec/unit/models/directory_unit_spec.rb +0 -127
  97. data/testing/rspec/spec/unit/models/doc_string_unit_spec.rb +0 -100
  98. data/testing/rspec/spec/unit/models/example_unit_spec.rb +0 -133
  99. data/testing/rspec/spec/unit/models/feature_file_unit_spec.rb +0 -125
  100. data/testing/rspec/spec/unit/models/feature_unit_spec.rb +0 -157
  101. data/testing/rspec/spec/unit/models/model_unit_spec.rb +0 -15
  102. data/testing/rspec/spec/unit/models/outline_unit_spec.rb +0 -117
  103. data/testing/rspec/spec/unit/models/row_unit_spec.rb +0 -68
  104. data/testing/rspec/spec/unit/models/scenario_unit_spec.rb +0 -86
  105. data/testing/rspec/spec/unit/models/step_unit_spec.rb +0 -109
  106. data/testing/rspec/spec/unit/models/table_unit_spec.rb +0 -77
  107. data/testing/rspec/spec/unit/models/tag_unit_spec.rb +0 -68
  108. data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
  109. data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
  110. data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
  111. data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
  112. data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
  113. data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -127
  114. data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
  115. data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
  116. data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
  117. data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
  118. data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
  119. data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
  120. data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
  121. data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
  122. data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
  123. data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
  124. data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
  125. data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
  126. data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
  127. data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
  128. data/testing/test_languages.json +0 -45
  129. 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