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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d96fde16c64a7ea6f2138c7378c074bcbab8531
4
- data.tar.gz: 993021b4c36832315de1e8b8fece7c7743e7ca5d
3
+ metadata.gz: e58e8070c7453412e6eafb4f217f074332f4dd7a
4
+ data.tar.gz: 8b1d97c2f13b45a8243ca2cb26b70b3128e8b769
5
5
  SHA512:
6
- metadata.gz: 5b423b019a5bb8a5cc965d6b9c1af1b32a01b1a0acfa426721b563aeaed764e0a2d3d3d2c4ce87258fc2ba5e721b5b99ffaff511a0d76747ad6cf4a96644b35d
7
- data.tar.gz: 48ab6716ca80419dcb4ab238d42a2792cf34600d6df993cf97ba08410a6ebc7ae63e1eba79cbd9cebd7f81f596e364d0cc105ce6ba398cb08e8ee0ccde2344fa
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.0
4
+ - 2.1.7
5
+ - 2.2.3
6
6
  - jruby-19mode
7
7
 
8
8
  gemfile:
9
9
  - Gemfile
10
- - Gemfile_turnip_1_1_0_rspec_2
11
- - Gemfile_turnip_1_1_0
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: 1.9.3
18
- gemfile: Gemfile_turnip_1_1_0_rspec_2
19
- - rvm: 2.1.0
20
- gemfile: Gemfile_turnip_1_1_0_rspec_2
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: Gemfile_turnip_1_1_0_rspec_2
23
- - rvm: 1.9.3
24
- gemfile: Gemfile_turnip_1_1_0
25
- - rvm: 2.1.0
26
- gemfile: Gemfile_turnip_1_1_0
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: Gemfile_turnip_1_1_0
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
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rutabaga.gemspec
4
4
  gemspec
5
+
@@ -2,4 +2,4 @@
2
2
  eval(IO.read('Gemfile'), binding)
3
3
 
4
4
  # Test lowest supported version of rspec
5
- gem 'rspec', '~>2.7.0'
5
+ gem 'rspec', '~>2.14'
@@ -1,4 +1,4 @@
1
1
  # Use global Gemfile and customize
2
2
  eval(IO.read('Gemfile'), binding)
3
3
 
4
- gem 'turnip', '1.1.0'
4
+ gem 'turnip', '1.2.4'
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.
@@ -0,0 +1,8 @@
1
+ Feature: Test that background steps are properly called
2
+
3
+ Background:
4
+ Given we add 10
5
+
6
+ Scenario: ensures the feature is called
7
+ Given that 2 * 4 is calculated
8
+ Then my result is 18
@@ -11,7 +11,7 @@ describe "test" do
11
11
  end
12
12
 
13
13
  step "my result is :result" do |result|
14
- result.to_i.should == @first.to_i + @second.to_i
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
- result.to_i.should == @first.to_i + @second.to_i - 1
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
- result.to_i.should == @first.to_i + @second.to_i
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
- result.to_i.should == @first.to_i * @second.to_i
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
@@ -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
- rspec_class = self.class
8
+ example_group_class = self.class
8
9
 
9
10
  # Hack turnip into the rspec only when needed
10
- rspec_class.send(:include, Turnip::RSpec::Execute)
11
- rspec_class.send(:include, Turnip::Steps)
11
+ example_group_class.send(:include, Turnip::RSpec::Execute)
12
+ example_group_class.send(:include, Turnip::Steps)
12
13
 
13
- builder = Turnip::Builder.build(feature_file)
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
@@ -1,3 +1,3 @@
1
1
  module Rutabaga
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
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.should include('ensures the feature is called')
10
- @result.should include('that 2 + 2 is calculated')
11
- @result.should include('my result is 4')
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.should_not include('PENDING')
16
- @result.should_not include('No such step')
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.should include('8 examples, 1 failure')
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.should_not include('Feature file not found')
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.should include('that 2 * 4 is calculated')
29
- @result.should include('my result is 8')
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.should_not include('Turnip::Ambiguous')
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.1.1
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: 2014-11-05 00:00:00.000000000 Z
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
- - Gemfile_rspec_2_7
44
- - Gemfile_turnip_1_1_0
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.0.14
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:
@@ -1,6 +0,0 @@
1
- # Use global Gemfile and customize
2
- eval(IO.read('Gemfile'), binding)
3
-
4
- # Avoid deprecation warnings for rspec 2.99
5
- gem 'rspec', '~>2.7', '<2.99'
6
- gem 'turnip', '1.1.0'