turnip 0.3.1 → 1.0.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.
- data/README.md +128 -166
- data/examples/autoload_steps.feature +3 -2
- data/examples/errors.feature +8 -0
- data/examples/step_calling.feature +2 -0
- data/examples/steps/alignment_steps.rb +23 -0
- data/examples/{autoload_steps.rb → steps/autoload_steps.rb} +0 -0
- data/examples/steps/backtick_steps.rb +10 -0
- data/examples/steps/dragon_steps.rb +41 -0
- data/examples/{knight_steps.rb → steps/knight_steps.rb} +3 -1
- data/examples/{more_steps.rb → steps/more_steps.rb} +0 -0
- data/examples/{step_calling_steps.rb → steps/step_calling_steps.rb} +0 -0
- data/examples/{steps.rb → steps/steps.rb} +25 -1
- data/examples/steps_for.feature +2 -2
- data/examples/steps_with_variations.feature +17 -0
- data/lib/turnip.rb +19 -34
- data/lib/turnip/builder.rb +26 -24
- data/lib/turnip/define.rb +9 -0
- data/lib/turnip/dsl.rb +11 -17
- data/lib/turnip/execute.rb +15 -0
- data/lib/turnip/rspec.rb +80 -0
- data/lib/turnip/step_definition.rb +7 -32
- data/lib/turnip/version.rb +1 -1
- data/spec/builder_spec.rb +1 -40
- data/spec/define_and_execute.rb +38 -0
- data/spec/dsl_spec.rb +36 -19
- data/spec/integration_spec.rb +5 -1
- data/spec/spec_helper.rb +1 -3
- data/spec/step_definition_spec.rb +37 -51
- metadata +25 -55
- data/examples/alignment_steps.rb +0 -7
- data/examples/backtick_steps.rb +0 -4
- data/examples/dragon_steps.rb +0 -17
- data/examples/evil_steps.rb +0 -7
- data/examples/neutral_steps.rb +0 -7
- data/examples/red_dragon_steps.rb +0 -18
- data/lib/turnip/config.rb +0 -18
- data/lib/turnip/feature_file.rb +0 -20
- data/lib/turnip/loader.rb +0 -16
- data/lib/turnip/runner_dsl.rb +0 -9
- data/lib/turnip/scenario_context.rb +0 -41
- data/lib/turnip/scenario_runner.rb +0 -35
- data/lib/turnip/step_loader.rb +0 -27
- data/lib/turnip/step_module.rb +0 -89
- data/spec/feature_file_spec.rb +0 -18
- data/spec/runner_dsl_spec.rb +0 -23
- data/spec/scenario_context_spec.rb +0 -51
- data/spec/scenario_runner_spec.rb +0 -79
- data/spec/step_loader_spec.rb +0 -29
- data/spec/step_module_spec.rb +0 -106
data/spec/step_loader_spec.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'turnip/step_loader'
|
2
|
-
|
3
|
-
describe Turnip::StepLoader do
|
4
|
-
describe '.load_steps' do
|
5
|
-
context 'when the steps have not been loaded' do
|
6
|
-
before { Turnip::StepLoader.steps_loaded = false }
|
7
|
-
|
8
|
-
it 'loads all the steps' do
|
9
|
-
Turnip::StepLoader.should_receive :load_step_files
|
10
|
-
Turnip::StepLoader.load_steps
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'marks the steps as loaded' do
|
14
|
-
Turnip::StepLoader.stub :load_step_files
|
15
|
-
Turnip::StepLoader.load_steps
|
16
|
-
Turnip::StepLoader.should be_steps_loaded
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'when the steps have been loaded' do
|
21
|
-
before { Turnip::StepLoader.steps_loaded = true }
|
22
|
-
|
23
|
-
it 'does not reload all the steps' do
|
24
|
-
Turnip::StepLoader.should_not_receive :load_step_files
|
25
|
-
Turnip::StepLoader.load_steps
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/spec/step_module_spec.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
describe Turnip::StepModule do
|
2
|
-
before(:each) do
|
3
|
-
Turnip::StepModule.clear_module_registry
|
4
|
-
end
|
5
|
-
|
6
|
-
describe '.modules_for' do
|
7
|
-
it 'returns the unique registered modules' do
|
8
|
-
Turnip::StepModule.steps_for(:first) {}
|
9
|
-
Turnip::StepModule.steps_for(:second) {}
|
10
|
-
Turnip::StepModule.modules_for(:first, :second).size.should eq(2)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'returns the unique registered modules with use_steps' do
|
14
|
-
Turnip::StepModule.steps_for(:first) {}
|
15
|
-
Turnip::StepModule.steps_for(:second) { use_steps :first }
|
16
|
-
Turnip::StepModule.steps_for(:third) { use_steps :first, :second }
|
17
|
-
Turnip::StepModule.modules_for(:third).size.should eq(3)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'ignores a circular step dependency' do
|
21
|
-
Turnip::StepModule.steps_for(:first) { use_steps :second }
|
22
|
-
Turnip::StepModule.steps_for(:second) { use_steps :first }
|
23
|
-
expect do
|
24
|
-
Turnip::StepModule.modules_for(:second)
|
25
|
-
end.should_not raise_error
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'orders the step modules from use_steps before the using step module' do
|
29
|
-
Turnip::StepModule.steps_for(:first) {}
|
30
|
-
Turnip::StepModule.steps_for(:second) { use_steps :first }
|
31
|
-
Turnip::StepModule.modules_for(:second).first.should == Turnip::StepModule.module_registry[:first].first.step_module
|
32
|
-
Turnip::StepModule.modules_for(:second).last.should == Turnip::StepModule.module_registry[:second].first.step_module
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe '.steps_for' do
|
37
|
-
it 'registers the given tag' do
|
38
|
-
Turnip::StepModule.steps_for(:first) {}
|
39
|
-
Turnip::StepModule.should be_registered(:first)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'registers an anonymous modle for the given tags' do
|
43
|
-
Turnip::StepModule.steps_for(:first) {}
|
44
|
-
Turnip::StepModule.module_registry[:first].first.step_module.should be_instance_of(Module)
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '.step_module' do
|
50
|
-
subject do
|
51
|
-
Turnip::StepModule.step_module do
|
52
|
-
def marker; end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'extends the steps DSL' do
|
57
|
-
subject.should be_kind_of(Turnip::StepModule::DSL)
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'creates an anonymous module' do
|
61
|
-
# Check for empty string to allow for rbx
|
62
|
-
subject.name.should satisfy {|name| name.nil? || name.empty? }
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'executes the block in the module' do
|
66
|
-
# Map to sym to allow for rbx
|
67
|
-
subject.instance_methods.map(&:to_sym).should include(:marker)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe Turnip::StepModule::DSL do
|
72
|
-
describe '.step' do
|
73
|
-
it 'registers the step for the module' do
|
74
|
-
mod = Module.new do
|
75
|
-
extend Turnip::StepModule::DSL
|
76
|
-
step('example') { true }
|
77
|
-
end
|
78
|
-
mod.steps.first.expression.should eq('example')
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe '.placeholder' do
|
83
|
-
before { Turnip::Placeholder.send(:placeholders).clear }
|
84
|
-
|
85
|
-
it 'registers the placeholder globally' do
|
86
|
-
mod = Module.new do
|
87
|
-
extend Turnip::StepModule::DSL
|
88
|
-
placeholder('example') { true }
|
89
|
-
end
|
90
|
-
Turnip::Placeholder.send(:placeholders).should have_key('example')
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe '.use_steps' do
|
95
|
-
it "updates the list of used steps" do
|
96
|
-
mod = Module.new do
|
97
|
-
extend Turnip::StepModule::DSL
|
98
|
-
step('example') { true }
|
99
|
-
|
100
|
-
use_steps :other_steps
|
101
|
-
end
|
102
|
-
mod.uses_steps.should include(:other_steps)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|