cuke_modeler 1.4.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +329 -0
- data/LICENSE.txt +1 -1
- data/README.md +25 -18
- data/cuke_modeler.gemspec +15 -9
- data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/{gherkin_6_adapter.rb → gherkin_9_adapter.rb} +75 -64
- data/lib/cuke_modeler/containing.rb +16 -0
- data/lib/cuke_modeler/described.rb +1 -0
- data/lib/cuke_modeler/models/background.rb +1 -1
- data/lib/cuke_modeler/models/cell.rb +1 -1
- data/lib/cuke_modeler/models/comment.rb +1 -1
- data/lib/cuke_modeler/models/directory.rb +2 -2
- data/lib/cuke_modeler/models/doc_string.rb +1 -1
- data/lib/cuke_modeler/models/example.rb +1 -1
- data/lib/cuke_modeler/models/feature.rb +1 -1
- data/lib/cuke_modeler/models/feature_file.rb +2 -2
- data/lib/cuke_modeler/models/outline.rb +1 -1
- data/lib/cuke_modeler/models/row.rb +1 -1
- data/lib/cuke_modeler/models/scenario.rb +1 -1
- data/lib/cuke_modeler/models/step.rb +32 -3
- data/lib/cuke_modeler/models/table.rb +1 -1
- data/lib/cuke_modeler/models/tag.rb +1 -1
- data/lib/cuke_modeler/named.rb +1 -0
- data/lib/cuke_modeler/nested.rb +1 -0
- data/lib/cuke_modeler/parsed.rb +1 -0
- data/lib/cuke_modeler/parsing.rb +88 -92
- data/lib/cuke_modeler/sourceable.rb +1 -0
- data/lib/cuke_modeler/stepped.rb +1 -0
- data/lib/cuke_modeler/taggable.rb +1 -0
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/features/analysis/step_comparison.feature +25 -0
- data/testing/cucumber/features/analysis/test_comparison.feature +1 -1
- metadata +55 -142
- data/.gitignore +0 -18
- data/.simplecov +0 -7
- data/.travis.yml +0 -54
- data/Gemfile +0 -36
- data/History.md +0 -191
- data/Rakefile +0 -63
- data/appveyor.yml +0 -43
- data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -273
- data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -296
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -308
- data/testing/cucumber/step_definitions/action_steps.rb +0 -13
- data/testing/cucumber/step_definitions/background_steps.rb +0 -1
- data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
- data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
- data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
- data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
- data/testing/cucumber/step_definitions/modeling_steps.rb +0 -44
- data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
- data/testing/cucumber/step_definitions/step_steps.rb +0 -3
- data/testing/cucumber/step_definitions/table_steps.rb +0 -1
- data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
- data/testing/cucumber/step_definitions/verification_steps.rb +0 -173
- data/testing/cucumber/support/env.rb +0 -30
- data/testing/dialect_helper.rb +0 -48
- data/testing/file_helper.rb +0 -47
- data/testing/gemfiles/gherkin2.gemfile +0 -32
- data/testing/gemfiles/gherkin3.gemfile +0 -26
- data/testing/gemfiles/gherkin4.gemfile +0 -27
- data/testing/gemfiles/gherkin5.gemfile +0 -26
- data/testing/gemfiles/gherkin6.gemfile +0 -10
- data/testing/rspec/spec/integration/background_integration_spec.rb +0 -442
- data/testing/rspec/spec/integration/cell_integration_spec.rb +0 -335
- data/testing/rspec/spec/integration/comment_integration_spec.rb +0 -177
- data/testing/rspec/spec/integration/directory_integration_spec.rb +0 -218
- data/testing/rspec/spec/integration/doc_string_integration_spec.rb +0 -402
- data/testing/rspec/spec/integration/example_integration_spec.rb +0 -741
- data/testing/rspec/spec/integration/feature_file_integration_spec.rb +0 -272
- data/testing/rspec/spec/integration/feature_integration_spec.rb +0 -650
- data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +0 -165
- data/testing/rspec/spec/integration/gherkin_6_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/model_integration_spec.rb +0 -15
- data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
- data/testing/rspec/spec/integration/outline_integration_spec.rb +0 -624
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -117
- data/testing/rspec/spec/integration/row_integration_spec.rb +0 -291
- data/testing/rspec/spec/integration/scenario_integration_spec.rb +0 -479
- data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
- data/testing/rspec/spec/integration/step_integration_spec.rb +0 -475
- data/testing/rspec/spec/integration/table_integration_spec.rb +0 -337
- data/testing/rspec/spec/integration/tag_integration_spec.rb +0 -259
- data/testing/rspec/spec/spec_helper.rb +0 -122
- data/testing/rspec/spec/unit/background_unit_spec.rb +0 -83
- data/testing/rspec/spec/unit/cell_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/comment_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/directory_unit_spec.rb +0 -127
- data/testing/rspec/spec/unit/doc_string_unit_spec.rb +0 -100
- data/testing/rspec/spec/unit/example_unit_spec.rb +0 -133
- data/testing/rspec/spec/unit/feature_file_unit_spec.rb +0 -125
- data/testing/rspec/spec/unit/feature_unit_spec.rb +0 -157
- data/testing/rspec/spec/unit/model_unit_spec.rb +0 -15
- data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
- data/testing/rspec/spec/unit/outline_unit_spec.rb +0 -117
- data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
- data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
- data/testing/rspec/spec/unit/row_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/scenario_unit_spec.rb +0 -86
- data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
- data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -25
- data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
- data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
- data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
- data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
- data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
- data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
- data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
- data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
- data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
- data/testing/rspec/spec/unit/step_unit_spec.rb +0 -109
- data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/table_unit_spec.rb +0 -77
- data/testing/rspec/spec/unit/tag_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
- data/testing/test_languages.json +0 -45
- data/todo.txt +0 -24
@@ -1,122 +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
|
-
|
29
|
-
# Use a random dialect for testing in order to avoid hard coded language assumptions in the
|
30
|
-
# implementation and making the test dialect the default dialect so that language headers
|
31
|
-
# aren't needed for all of the test code. Only possible with some versions of Gherkin.
|
32
|
-
|
33
|
-
gherkin_version = Gem.loaded_specs['gherkin'].version.version
|
34
|
-
|
35
|
-
case gherkin_version
|
36
|
-
when /^6\./
|
37
|
-
# gherkin 6 does not preload the dialect module
|
38
|
-
require 'gherkin/dialect' if Gem.loaded_specs['gherkin'].version.version[/^6\./]
|
39
|
-
|
40
|
-
# TODO: choose randomly from Gherkin::DIALECTS once I figure out how to handle encodings...
|
41
|
-
test_dialect = ['en', 'en-lol', 'en-pirate', 'en-Scouse'].sample
|
42
|
-
puts "Testing with dialect '#{test_dialect}'..."
|
43
|
-
|
44
|
-
|
45
|
-
CukeModeler::DialectHelper.set_dialect(Gherkin::DIALECTS[test_dialect])
|
46
|
-
CukeModeler::Parsing.dialect = test_dialect
|
47
|
-
when /^[543]\./
|
48
|
-
# TODO: stop using test dialect and just randomize for all version of `gherkin`
|
49
|
-
dialect_file_path = "#{this_dir}/../../test_languages.json"
|
50
|
-
test_dialects = JSON.parse File.open(dialect_file_path, 'r:UTF-8').read
|
51
|
-
|
52
|
-
Gherkin::DIALECTS.merge!(test_dialects)
|
53
|
-
|
54
|
-
|
55
|
-
module Gherkin
|
56
|
-
class Parser
|
57
|
-
|
58
|
-
alias_method :original_parse, :parse
|
59
|
-
|
60
|
-
def parse(token_scanner, token_matcher = TokenMatcher.new('cm-test'))
|
61
|
-
original_parse(token_scanner, token_matcher)
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
CukeModeler::DialectHelper.set_dialect(test_dialects['cm-test'])
|
68
|
-
CukeModeler::Parsing.dialect = 'cm-test'
|
69
|
-
when /^2\./
|
70
|
-
CukeModeler::DialectHelper.set_dialect(Gherkin::I18n::LANGUAGES['en'])
|
71
|
-
CukeModeler::Parsing.dialect = 'en'
|
72
|
-
else
|
73
|
-
raise("Unknown Gherkin version: '#{gherkin_version}'")
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
RSpec.configure do |config|
|
78
|
-
gherkin_version = Gem.loaded_specs['gherkin'].version.version
|
79
|
-
|
80
|
-
case gherkin_version
|
81
|
-
when /^6\./
|
82
|
-
config.filter_run_excluding :gherkin2 => true,
|
83
|
-
:gherkin3 => true,
|
84
|
-
:gherkin4_5 => true,
|
85
|
-
:gherkin6 => false
|
86
|
-
when /^[54]\./
|
87
|
-
config.filter_run_excluding :gherkin2 => true,
|
88
|
-
:gherkin3 => true,
|
89
|
-
:gherkin4_5 => false,
|
90
|
-
:gherkin6 => true
|
91
|
-
when /^3\./
|
92
|
-
config.filter_run_excluding :gherkin2 => true,
|
93
|
-
:gherkin3 => false,
|
94
|
-
:gherkin4_5 => true,
|
95
|
-
:gherkin6 => true
|
96
|
-
when /^2\./
|
97
|
-
config.filter_run_excluding :gherkin2 => false,
|
98
|
-
:gherkin3 => true,
|
99
|
-
:gherkin4_5 => true,
|
100
|
-
:gherkin6 => true
|
101
|
-
else
|
102
|
-
raise("Unknown Gherkin version: '#{gherkin_version}'")
|
103
|
-
end
|
104
|
-
|
105
|
-
config.before(:suite) do
|
106
|
-
FEATURE_KEYWORD = CukeModeler::DialectHelper.feature_keyword
|
107
|
-
BACKGROUND_KEYWORD = CukeModeler::DialectHelper.background_keyword
|
108
|
-
SCENARIO_KEYWORD = CukeModeler::DialectHelper.scenario_keyword
|
109
|
-
OUTLINE_KEYWORD = CukeModeler::DialectHelper.outline_keyword
|
110
|
-
EXAMPLE_KEYWORD = CukeModeler::DialectHelper.example_keyword
|
111
|
-
STEP_KEYWORD = CukeModeler::DialectHelper.step_keyword
|
112
|
-
GIVEN_KEYWORD = CukeModeler::DialectHelper.given_keyword
|
113
|
-
THEN_KEYWORD = CukeModeler::DialectHelper.then_keyword
|
114
|
-
end
|
115
|
-
|
116
|
-
config.after(:suite) do
|
117
|
-
CukeModeler::FileHelper.created_directories.each do |dir_path|
|
118
|
-
FileUtils.remove_entry(dir_path, true)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
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
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'Cell, Unit', :unit_test => true do
|
5
|
-
|
6
|
-
let(:clazz) { CukeModeler::Cell }
|
7
|
-
let(:cell) { 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 a value' do
|
22
|
-
expect(cell).to respond_to(:value)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'can change its value' do
|
26
|
-
expect(cell).to respond_to(:value=)
|
27
|
-
|
28
|
-
cell.value = :some_value
|
29
|
-
expect(cell.value).to eq(:some_value)
|
30
|
-
cell.value = :some_other_value
|
31
|
-
expect(cell.value).to eq(:some_other_value)
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
describe 'abstract instantiation' do
|
36
|
-
|
37
|
-
context 'a new cell object' do
|
38
|
-
|
39
|
-
let(:cell) { clazz.new }
|
40
|
-
|
41
|
-
|
42
|
-
it 'starts with no value' do
|
43
|
-
expect(cell.value).to be_nil
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
describe 'cell output' do
|
52
|
-
|
53
|
-
context 'from abstract instantiation' do
|
54
|
-
|
55
|
-
let(:cell) { clazz.new }
|
56
|
-
|
57
|
-
|
58
|
-
it 'can output an empty cell' do
|
59
|
-
expect { cell.to_s }.to_not raise_error
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
@@ -1,68 +0,0 @@
|
|
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
|
-
context 'from abstract instantiation' do
|
56
|
-
|
57
|
-
let(:comment) { clazz.new }
|
58
|
-
|
59
|
-
|
60
|
-
it 'can output an empty comment' do
|
61
|
-
expect { comment.to_s }.to_not raise_error
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
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,127 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'Directory, Unit', :unit_test => true do
|
5
|
-
|
6
|
-
let(:clazz) { CukeModeler::Directory }
|
7
|
-
let(:directory) { clazz.new }
|
8
|
-
|
9
|
-
|
10
|
-
describe 'common behavior' do
|
11
|
-
|
12
|
-
it_should_behave_like 'a model'
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
describe 'unique behavior' do
|
18
|
-
|
19
|
-
it 'has a name' do
|
20
|
-
expect(directory).to respond_to(:name)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'derives its directory name from its path' do
|
24
|
-
directory.path = 'path/to/foo'
|
25
|
-
|
26
|
-
expect(directory.name).to eq('foo')
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
describe 'attributes' do
|
31
|
-
|
32
|
-
it 'has a path' do
|
33
|
-
expect(directory).to respond_to(:path)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'can change its path' do
|
37
|
-
expect(directory).to respond_to(:path=)
|
38
|
-
|
39
|
-
directory.path = :some_path
|
40
|
-
expect(directory.path).to eq(:some_path)
|
41
|
-
directory.path = :some_other_path
|
42
|
-
expect(directory.path).to eq(:some_other_path)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'has feature files' do
|
46
|
-
expect(directory).to respond_to(:feature_files)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'can change its feature files' do
|
50
|
-
expect(directory).to respond_to(:feature_files=)
|
51
|
-
|
52
|
-
directory.feature_files = :some_feature_files
|
53
|
-
expect(directory.feature_files).to eq(:some_feature_files)
|
54
|
-
directory.feature_files = :some_other_feature_files
|
55
|
-
expect(directory.feature_files).to eq(:some_other_feature_files)
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'has directories' do
|
59
|
-
expect(directory).to respond_to(:directories)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'can change its directories' do
|
63
|
-
expect(directory).to respond_to(:directories=)
|
64
|
-
|
65
|
-
directory.directories = :some_directories
|
66
|
-
expect(directory.directories).to eq(:some_directories)
|
67
|
-
directory.directories = :some_other_directories
|
68
|
-
expect(directory.directories).to eq(:some_other_directories)
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
describe 'abstract instantiation' do
|
75
|
-
|
76
|
-
context 'a new directory object' do
|
77
|
-
|
78
|
-
let(:directory) { clazz.new }
|
79
|
-
|
80
|
-
|
81
|
-
it 'starts with no path' do
|
82
|
-
expect(directory.path).to be_nil
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'starts with no name' do
|
86
|
-
expect(directory.name).to be_nil
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'starts with no feature files or directories' do
|
90
|
-
expect(directory.feature_files).to eq([])
|
91
|
-
expect(directory.directories).to eq([])
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'contains feature files and directories' do
|
99
|
-
directories = [:directory_1, :directory_2, :directory_3]
|
100
|
-
files = [:file_1, :file_2, :file_3]
|
101
|
-
everything = files + directories
|
102
|
-
|
103
|
-
directory.directories = directories
|
104
|
-
directory.feature_files = files
|
105
|
-
|
106
|
-
expect(directory.children).to match_array(everything)
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
describe 'directory output' do
|
111
|
-
|
112
|
-
context 'from abstract instantiation' do
|
113
|
-
|
114
|
-
let(:directory) { clazz.new }
|
115
|
-
|
116
|
-
|
117
|
-
it 'can output an empty directory' do
|
118
|
-
expect { directory.to_s }.to_not raise_error
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|
124
|
-
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|