rutabaga 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +14 -21
- data/Gemfile +1 -0
- data/{Gemfile_rspec_2_7 → Gemfile_rspec_2_14} +1 -1
- data/{Gemfile_turnip_1_1_0 → Gemfile_turnip_1_2_4} +1 -1
- data/README.md +4 -0
- data/examples/test_background.feature +8 -0
- data/examples/test_spec.rb +24 -4
- data/lib/rutabaga/feature.rb +34 -25
- data/lib/rutabaga/version.rb +1 -1
- data/rutabaga.gemspec +2 -1
- data/spec/feature_spec.rb +10 -10
- metadata +21 -6
- data/Gemfile_turnip_1_1_0_rspec_2 +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e58e8070c7453412e6eafb4f217f074332f4dd7a
|
4
|
+
data.tar.gz: 8b1d97c2f13b45a8243ca2cb26b70b3128e8b769
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cb1eb1ac790e09087282c9fffedfd0ee043cbd4176db57c6cafac8a30413f0399a880e49b1955885453ca07e301dcff975c872d47cf0c607ae4d1f6e97a4fc7
|
7
|
+
data.tar.gz: 0e970b4afb65f580d050f4e246bf8f715ce3915b4ca339ab2e8efb579cf4dab5410ac12fa3c002024a38e98d8c02553f7e7cfc6e2890bf843d7d0425974bdc32
|
data/.travis.yml
CHANGED
@@ -1,36 +1,29 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.9.3
|
4
3
|
- 2.0.0
|
5
|
-
- 2.1.
|
4
|
+
- 2.1.7
|
5
|
+
- 2.2.3
|
6
6
|
- jruby-19mode
|
7
7
|
|
8
8
|
gemfile:
|
9
9
|
- Gemfile
|
10
|
-
-
|
11
|
-
-
|
12
|
-
- Gemfile_rspec_2_7
|
10
|
+
- Gemfile_turnip_1_2_4
|
11
|
+
- Gemfile_rspec_2_14
|
13
12
|
|
14
13
|
# Run the full suite against ruby 2.0.0 only
|
15
14
|
matrix:
|
16
15
|
exclude:
|
17
|
-
- rvm:
|
18
|
-
gemfile:
|
19
|
-
- rvm: 2.1.
|
20
|
-
gemfile:
|
16
|
+
- rvm: 2.0.0
|
17
|
+
gemfile: Gemfile_turnip_1_2_4
|
18
|
+
- rvm: 2.1.7
|
19
|
+
gemfile: Gemfile_turnip_1_2_4
|
21
20
|
- rvm: jruby-19mode
|
22
|
-
gemfile:
|
23
|
-
- rvm:
|
24
|
-
gemfile:
|
25
|
-
- rvm: 2.1.
|
26
|
-
gemfile:
|
21
|
+
gemfile: Gemfile_turnip_1_2_4
|
22
|
+
- rvm: 2.0.0
|
23
|
+
gemfile: Gemfile_rspec_2_14
|
24
|
+
- rvm: 2.1.7
|
25
|
+
gemfile: Gemfile_rspec_2_14
|
27
26
|
- rvm: jruby-19mode
|
28
|
-
gemfile:
|
29
|
-
- rvm: 1.9.3
|
30
|
-
gemfile: Gemfile_rspec_2_7
|
31
|
-
- rvm: 2.1.0
|
32
|
-
gemfile: Gemfile_rspec_2_7
|
33
|
-
- rvm: jruby-19mode
|
34
|
-
gemfile: Gemfile_rspec_2_7
|
27
|
+
gemfile: Gemfile_rspec_2_14
|
35
28
|
|
36
29
|
script: bundle exec rspec spec
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -145,6 +145,10 @@ My goal is to test just the business rule, in Turnip, and not the login, the htm
|
|
145
145
|
4. Push to the branch (`git push origin my-new-feature`)
|
146
146
|
5. Create new Pull Request
|
147
147
|
|
148
|
+
## For maintainers
|
149
|
+
|
150
|
+
Use `gem-release` to maintain versions https://github.com/svenfuchs/gem-release.
|
151
|
+
|
148
152
|
## Copyright
|
149
153
|
|
150
154
|
Copyright © 2012 Simply Business. See LICENSE for details.
|
data/examples/test_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe "test" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
step "my result is :result" do |result|
|
14
|
-
|
14
|
+
expect(@first.to_i + @second.to_i).to eq(result.to_i)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -26,7 +26,7 @@ describe "should find the feature file using the root (and monkey patching the r
|
|
26
26
|
end
|
27
27
|
|
28
28
|
step "my result is :result" do |result|
|
29
|
-
|
29
|
+
expect(@first.to_i + @second.to_i - 1).to eq(result.to_i)
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -42,7 +42,7 @@ describe "causes a failing test" do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
step "my result is :result" do |result|
|
45
|
-
|
45
|
+
expect(@first.to_i + @second.to_i).to eq(result.to_i)
|
46
46
|
end
|
47
47
|
|
48
48
|
end
|
@@ -58,7 +58,27 @@ describe "finds a feature file given as parameter to the 'feature' method" do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
step "my result is :result" do |result|
|
61
|
-
|
61
|
+
expect(@first.to_i * @second.to_i).to eq(result.to_i)
|
62
62
|
end
|
63
63
|
|
64
64
|
end
|
65
|
+
|
66
|
+
describe "backgrounds are properly called" do
|
67
|
+
it "implements the named feature" do
|
68
|
+
feature "examples/test_background.feature"
|
69
|
+
end
|
70
|
+
|
71
|
+
step "we add :initial" do |initial|
|
72
|
+
@initial = 10
|
73
|
+
end
|
74
|
+
|
75
|
+
step "that :first * :second is calculated" do |first, second|
|
76
|
+
@first = first
|
77
|
+
@second = second
|
78
|
+
end
|
79
|
+
|
80
|
+
step "my result is :result" do |result|
|
81
|
+
expect(@initial.to_i + @first.to_i * @second.to_i).to eq(result.to_i)
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
data/lib/rutabaga/feature.rb
CHANGED
@@ -1,37 +1,17 @@
|
|
1
1
|
require 'turnip/rspec'
|
2
|
+
require 'rspec'
|
2
3
|
|
3
4
|
module Rutabaga
|
4
5
|
module Feature
|
5
6
|
def feature(feature_file = find_feature)
|
6
7
|
|
7
|
-
|
8
|
+
example_group_class = self.class
|
8
9
|
|
9
10
|
# Hack turnip into the rspec only when needed
|
10
|
-
|
11
|
-
|
11
|
+
example_group_class.send(:include, Turnip::RSpec::Execute)
|
12
|
+
example_group_class.send(:include, Turnip::Steps)
|
12
13
|
|
13
|
-
|
14
|
-
builder.features.each do |feature|
|
15
|
-
rspec_class.describe(feature.name, feature.metadata_hash) do
|
16
|
-
rspec_class.before do
|
17
|
-
# This is kind of a hack, but it will make RSpec throw way nicer exceptions
|
18
|
-
get_example.metadata[:file_path] = feature_file
|
19
|
-
|
20
|
-
feature.backgrounds.map(&:steps).flatten.each do |step|
|
21
|
-
run_step(feature_file, step)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
feature.scenarios.each do |scenario|
|
25
|
-
rspec_class.describe(scenario.name, scenario.metadata_hash) do
|
26
|
-
it scenario.steps.map(&:description).join(' -> ') do
|
27
|
-
scenario.steps.each do |step|
|
28
|
-
run_step(feature_file, step)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
14
|
+
run(feature_file, example_group_class)
|
35
15
|
end
|
36
16
|
|
37
17
|
def find_feature
|
@@ -47,6 +27,35 @@ module Rutabaga
|
|
47
27
|
|
48
28
|
private
|
49
29
|
|
30
|
+
# Adapted from jnicklas/turnip v1.3.1
|
31
|
+
def run(feature_file, example_group_class)
|
32
|
+
Turnip::Builder.build(feature_file).features.each do |feature|
|
33
|
+
describe = example_group_class.describe feature.name, feature.metadata_hash
|
34
|
+
run_feature(describe, feature, feature_file, example_group_class)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def run_feature(describe, feature, filename, example_group_class)
|
39
|
+
example_group_class.before do
|
40
|
+
# This is kind of a hack, but it will make RSpec throw way nicer exceptions
|
41
|
+
get_example.metadata[:file_path] = filename
|
42
|
+
|
43
|
+
feature.backgrounds.map(&:steps).flatten.each do |step|
|
44
|
+
run_step(filename, step)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
feature.scenarios.each do |scenario|
|
49
|
+
example_group_class.describe scenario.name, scenario.metadata_hash do
|
50
|
+
it(scenario.steps.map(&:to_s).join(' -> ')) do
|
51
|
+
scenario.steps.each do |step|
|
52
|
+
run_step(filename, step)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
50
59
|
# For compatibility with rspec 2 and rspec 3. RSpec.current_example was added late in
|
51
60
|
# the rspec 2 cycle.
|
52
61
|
def get_example
|
data/lib/rutabaga/version.rb
CHANGED
data/rutabaga.gemspec
CHANGED
@@ -16,5 +16,6 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Rutabaga::VERSION
|
17
17
|
gem.license = 'MIT'
|
18
18
|
|
19
|
-
gem.add_runtime_dependency 'turnip', ['>= 1.1.0', '<2.0']
|
19
|
+
gem.add_runtime_dependency 'turnip', ['>= 1.1.0', '<2.0']
|
20
|
+
gem.add_development_dependency "pry", '~> 0'
|
20
21
|
end
|
data/spec/feature_spec.rb
CHANGED
@@ -6,31 +6,31 @@ describe 'integration', :type => :integration do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "shows the correct description" do
|
9
|
-
@result.
|
10
|
-
@result.
|
11
|
-
@result.
|
9
|
+
expect(@result).to include('ensures the feature is called')
|
10
|
+
expect(@result).to include('that 2 + 2 is calculated')
|
11
|
+
expect(@result).to include('my result is 4')
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should not show any pending steps" do
|
15
|
-
@result.
|
16
|
-
@result.
|
15
|
+
expect(@result).not_to include('PENDING')
|
16
|
+
expect(@result).not_to include('No such step')
|
17
17
|
end
|
18
18
|
|
19
19
|
it "prints out failures and successes" do
|
20
|
-
@result.
|
20
|
+
expect(@result).to include('10 examples, 1 failure')
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should find features relative to the root" do
|
24
|
-
@result.
|
24
|
+
expect(@result).not_to include('Feature file not found')
|
25
25
|
end
|
26
26
|
|
27
27
|
it "finds the .feature file given as parameter to the 'feature' method" do
|
28
|
-
@result.
|
29
|
-
@result.
|
28
|
+
expect(@result).to include('that 2 * 4 is calculated')
|
29
|
+
expect(@result).to include('my result is 8')
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should scope steps to describe blocks" do
|
33
|
-
@result.
|
33
|
+
expect(@result).not_to include('Turnip::Ambiguous')
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rutabaga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Oberhuber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: turnip
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - <
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: pry
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ~>
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
33
47
|
description: Allows using feature from within RSpec and is built on top of Turnip
|
34
48
|
email:
|
35
49
|
- lukas.oberhuber@simplybusiness.co.uk
|
@@ -40,9 +54,8 @@ files:
|
|
40
54
|
- .gitignore
|
41
55
|
- .travis.yml
|
42
56
|
- Gemfile
|
43
|
-
-
|
44
|
-
-
|
45
|
-
- Gemfile_turnip_1_1_0_rspec_2
|
57
|
+
- Gemfile_rspec_2_14
|
58
|
+
- Gemfile_turnip_1_2_4
|
46
59
|
- LICENSE
|
47
60
|
- README.md
|
48
61
|
- Rakefile
|
@@ -50,6 +63,7 @@ files:
|
|
50
63
|
- examples/test.feature
|
51
64
|
- examples/test2.feature
|
52
65
|
- examples/test3.feature
|
66
|
+
- examples/test_background.feature
|
53
67
|
- examples/test_spec.rb
|
54
68
|
- lib/rutabaga.rb
|
55
69
|
- lib/rutabaga/feature.rb
|
@@ -77,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
91
|
version: '0'
|
78
92
|
requirements: []
|
79
93
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.4.8
|
81
95
|
signing_key:
|
82
96
|
specification_version: 4
|
83
97
|
summary: Calling Turnip feature files from RSpec, which allows encapsulating a feature
|
@@ -85,3 +99,4 @@ summary: Calling Turnip feature files from RSpec, which allows encapsulating a f
|
|
85
99
|
test_files:
|
86
100
|
- spec/feature_spec.rb
|
87
101
|
- spec/spec_helper.rb
|
102
|
+
has_rdoc:
|