spinach 0.8.3 → 0.8.4

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: 83c66a61a7a2acb9a68481350f9eb89d95e48eec
4
- data.tar.gz: 7e2f76bef3a0796aa342bb9bdd0f1589de02e678
3
+ metadata.gz: b1c11894781bc3f2957b12b1745d9fed1842736c
4
+ data.tar.gz: 2fb1b64e1bbf60ec8248dbddd7bdce98d096dc73
5
5
  SHA512:
6
- metadata.gz: 68e0b156aa56a28d06cae2585f6504fda3648ea943db9fb5ccc33ecf5afc2ab9e2be16cd55187f0bc18febd3ab147d25263a7a2130d82c576696ff8b441c09ef
7
- data.tar.gz: fdd2eec1dc6d73374f6bbbb7c6b8610c0f73d56cb3110c8e01fb2cf60a46a912a506c09a0abb03173dccb9011b68842691cfc50b240eca9e223370e9d1fb8e16
6
+ metadata.gz: a7638b77452fc5810f7da5ffe4fbcd0f93ef5e9248d6e44a15538b8a07d8260cf1ff8ee41ae2d463a9f73d6449479feb837c025aab6f70fe55b0677008ebd8aa
7
+ data.tar.gz: fb0ef915c20adbb72c618579022b17b77f27b4d983ed48b1e6966504d280602e4f238c6ce9d23b7eb1c07e0293204f4b86c20cbf249488ed2fbdac09ebab69f3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0-p0
1
+ 2.0.0-p247
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
+ == 0.8.4
2
+ * fixed #138: The pending steps should abort the remaining scenario, but continue running other scenarios
3
+ * added the feature #140: Allow blockless step definitions
4
+
1
5
  == 0.8.3
2
- * Add ```--fail-fast``` option. When specified, the suite will terminate after the first failed scenario
6
+ * add ```--fail-fast``` option. when specified, the suite will terminate after the first failed scenario
3
7
 
4
8
  == 0.8.2
5
9
  * upgrade to gherkin-ruby 0.3 in order to avoid naming conflicts when using at
data/Gemfile CHANGED
@@ -11,6 +11,7 @@ group :test do
11
11
  gem 'guard-minitest'
12
12
  gem 'guard-spinach'
13
13
  gem 'capybara', '~> 2.0.0'
14
+ gem "rspec"
14
15
  end
15
16
 
16
17
  group :darwin do
data/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ Copyright (C) <2013> <Codegram Technologies>
2
+
3
+ MIT License (Expat)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown CHANGED
@@ -353,8 +353,7 @@ You can easily contribute to Spinach. Its codebase is simple and
353
353
 
354
354
  ## License
355
355
 
356
- MIT License. Copyright 2011 [Codegram Technologies](http://codegram.com)
357
-
356
+ MIT (Expat) License. Copyright 2011-2013 [Codegram Technologies](http://codegram.com)
358
357
 
359
358
  [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/codegram/spinach/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
360
359
 
@@ -0,0 +1,9 @@
1
+ Feature: Pending steps
2
+ In order to save running time
3
+ As a developer
4
+ I want spinach to fail fast when I so desire
5
+
6
+ Scenario: multiple scenarios
7
+ Given I have a feature that has a pending step
8
+ When I run the feature
9
+ Then the test stops at the pending step and reported as such
@@ -8,3 +8,9 @@ Feature: Pending feature reporting
8
8
  When I run spinach
9
9
  Then I should see a message telling me that there's a pending scenario
10
10
  And I should see a message showing me the reason of the pending scenario
11
+
12
+ Scenario: Step definition without body
13
+ Given I've written a step definition without body
14
+ When I run spinach
15
+ Then I should see a message telling me that there's a pending scenario
16
+ And I should see a message showing me the default reason of the pending scenario
@@ -0,0 +1,17 @@
1
+ class Spinach::Features::PendingSteps < Spinach::FeatureSteps
2
+ include Integration::SpinachRunner
3
+
4
+ step 'I have a feature that has a pending step' do
5
+ @feature = Integration::FeatureGenerator.pending_feature_with_multiple_scenario
6
+ end
7
+
8
+ step 'I run the feature' do
9
+ run_feature @feature
10
+ end
11
+
12
+ step 'the test stops at the pending step and reported as such' do
13
+ @stdout.must_match("(1) Successful")
14
+ @stdout.must_match("(0) Failed")
15
+ @stdout.must_match("(1) Pending")
16
+ end
17
+ end
@@ -24,6 +24,29 @@ class PendingFeatureReporting < Spinach::FeatureSteps
24
24
  pending "This step is pending."
25
25
  end
26
26
  end')
27
+
28
+ @feature = "features/pending_feature.feature"
29
+ end
30
+
31
+ Given "I've written a step definition without body" do
32
+ write_file(
33
+ 'features/pending_feature.feature',
34
+ """
35
+ Feature: A pending feature
36
+
37
+ Scenario: This scenario is pending
38
+ Given this is also a pending step
39
+ """)
40
+
41
+ write_file(
42
+ 'features/steps/pending_feature.rb',
43
+ 'class APendingFeature < Spinach::FeatureSteps
44
+
45
+ feature "A pending feature"
46
+
47
+ Given "this is also a pending step"
48
+ end')
49
+
27
50
  @feature = "features/pending_feature.feature"
28
51
  end
29
52
 
@@ -38,4 +61,9 @@ class PendingFeatureReporting < Spinach::FeatureSteps
38
61
  And "I should see a message showing me the reason of the pending scenario" do
39
62
  @stderr.must_include("This step is pending")
40
63
  end
64
+
65
+ And "I should see a message showing me the default reason of the pending scenario" do
66
+ @stderr.must_include("step not implemented")
67
+ end
68
+
41
69
  end
@@ -25,7 +25,7 @@ Feature: Feature without failures
25
25
 
26
26
  Given "I have a feature with some failed expectations" do
27
27
  write_file('features/feature_with_failures.feature', """
28
- Feature: Feature with failures
28
+ Feature: Feature with failures in RSpec compatibility test
29
29
 
30
30
  Scenario: This scenario will fail
31
31
  Given true is false
@@ -33,7 +33,7 @@ Feature: Feature with failures
33
33
 
34
34
  write_file('features/steps/failure_feature.rb',
35
35
  'class FeatureWithFailures < Spinach::FeatureSteps
36
- feature "Feature with failures"
36
+ feature "Feature with failures in RSpec compatibility test"
37
37
  Given "true is false" do
38
38
  true.should == false
39
39
  end
@@ -5,12 +5,18 @@ module Integration
5
5
  include Filesystem
6
6
 
7
7
  def check_error_messages(n = 1)
8
- @stderr.must_match /Failures \(#{n}\)/
8
+ @stderr.must_match failure_regex(n)
9
9
  end
10
10
 
11
11
  def check_backtrace(n = 1)
12
- @stderr.must_match /Failures \(#{n}\)/
13
- @stderr.must_match /gems.*(minitest|rspec).*assert_equal/
12
+ @stderr.must_match failure_regex(n)
13
+ @stderr.must_match /.*(minitest|rspec).*assert_equal/
14
+ end
15
+
16
+ private
17
+
18
+ def failure_regex(n)
19
+ /Failures \(#{n}\)/
14
20
  end
15
21
  end
16
22
  end
@@ -16,6 +16,19 @@ module Integration
16
16
  'features/steps/success_feature.rb', steps
17
17
  end
18
18
 
19
+ # Generate a feature with 1 scenario that has a pending step in between
20
+ #
21
+ # @return feature_filename
22
+ # The feature file name
23
+ #
24
+ # @api private
25
+ def pending_feature_with_multiple_scenario
26
+ feature_str = pending_feature_str + "\n" + success_scenario
27
+ steps = pending_step_class_str + pending_step + "\n" + failure_step_definition + success_step + "\nend"
28
+ write_feature 'features/success_feature.feature', feature_str,
29
+ 'features/steps/pending_feature_with_multiple_scenario.rb', steps
30
+ end
31
+
19
32
  # Generate a feature that has 2 scenarios. The first one should
20
33
  # pass and the second one should fail
21
34
  #
@@ -65,13 +78,25 @@ module Integration
65
78
  end
66
79
 
67
80
  def failure_step
68
- 'class AFailureFeature < Spinach::FeatureSteps
81
+ %Q|class AFailureFeature < Spinach::FeatureSteps
69
82
  feature "A failure feature"
70
- Then "I fail" do
83
+ %{failure_step_definition}
84
+ |
85
+ end
86
+
87
+ def failure_step_definition
88
+ 'step "I fail" do
71
89
  true.must_equal false
72
90
  end'
73
91
  end
74
92
 
93
+ def pending_feature_str
94
+ "Feature: A feature with pending steps
95
+ Scenario: This is scenario will be pending
96
+ When this is a pending step
97
+ Then I fail"
98
+ end
99
+
75
100
  def success_scenario
76
101
  'Scenario: This is scenario will succeed
77
102
  Then I succeed'
@@ -87,6 +112,18 @@ module Integration
87
112
  end'
88
113
  end
89
114
 
115
+ def pending_step_class_str
116
+ %Q|class ApendingFeature < Spinach::FeatureSteps
117
+ feature "A feature with pending steps"\n\n|
118
+ end
119
+
120
+ def pending_step
121
+ '
122
+ step "this is a pending step" do
123
+ pending "to be implemented"
124
+ end'
125
+ end
126
+
90
127
  def success_step_class_str
91
128
  %Q|class ASuccessFeature < Spinach::FeatureSteps
92
129
  feature "A success feature"\n\n|
@@ -37,7 +37,7 @@ module Integration
37
37
 
38
38
  def use_rspec
39
39
  write_file('features/support/minitest.rb',
40
- "require 'rspec'")
40
+ "require 'rspec/core'\nrequire 'rspec/expectations'")
41
41
  end
42
42
  end
43
43
  end
data/lib/spinach/dsl.rb CHANGED
@@ -26,6 +26,7 @@ module Spinach
26
26
  #
27
27
  # @param [Proc] block
28
28
  # Action to perform in that step.
29
+ # If no block is given, step will be defined as pending.
29
30
  #
30
31
  # @example
31
32
  # These 3 examples are equivalent:
@@ -50,7 +51,11 @@ module Spinach
50
51
  #
51
52
  # @api public
52
53
  def step(step, &block)
53
- define_method(Spinach::Support.underscore(step), &block)
54
+ method_body = if block_given? then block
55
+ else lambda { pending "step not implemented" }
56
+ end
57
+
58
+ define_method(Spinach::Support.underscore(step), &method_body)
54
59
  end
55
60
 
56
61
  alias_method :Given, :step
@@ -51,7 +51,7 @@ module Spinach
51
51
  steps.each do |step|
52
52
  Spinach.hooks.run_before_step step, step_definitions
53
53
 
54
- if @exception
54
+ if @exception || @has_pending_step
55
55
  Spinach.hooks.run_on_skipped_step step, step_definitions
56
56
  else
57
57
  run_step(step)
@@ -84,6 +84,7 @@ module Spinach
84
84
  Spinach.hooks.run_on_undefined_step step, @exception, step_definitions
85
85
  rescue Spinach::StepPendingException => e
86
86
  e.step = step
87
+ @has_pending_step = true
87
88
  Spinach.hooks.run_on_pending_step step, e
88
89
  rescue Exception => e
89
90
  @exception = e
@@ -1,4 +1,4 @@
1
1
  module Spinach
2
2
  # Spinach version.
3
- VERSION = "0.8.3"
3
+ VERSION = "0.8.4"
4
4
  end
@@ -96,8 +96,9 @@ Feature: A test feature
96
96
  Spinach.config.save_and_open_page_on_failure = true
97
97
  @feature_class.any_instance.expects(:save_and_open_page).once
98
98
  @feature_runner.run
99
+ Spinach.config.save_and_open_page_on_failure = false
99
100
  end
100
-
101
+
101
102
  it "doesn't saves and open the page if the option is deactivated" do
102
103
  @feature_runner = Spinach::Runner::FeatureRunner.new(failing_feature)
103
104
  Spinach.config.save_and_open_page_on_failure = false
@@ -49,6 +49,7 @@ module Spinach
49
49
 
50
50
  describe "bindings" do
51
51
  before do
52
+ Spinach.hooks.reset
52
53
  @reporter.bind
53
54
  end
54
55
 
@@ -154,6 +154,11 @@ module Spinach
154
154
  subject.instance_variable_get(:@exception).must_be_kind_of(NilClass)
155
155
  end
156
156
 
157
+ it 'sets the has_pending_step' do
158
+ subject.run_step(@step)
159
+ subject.instance_variable_get(:@has_pending_step).must_equal(true)
160
+ end
161
+
157
162
  it 'runs the pending hooks' do
158
163
  Spinach.hooks.expects(:run_on_pending_step).with(@step, kind_of(Spinach::StepPendingException))
159
164
  subject.run_step(@step)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spinach
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-06-04 00:00:00.000000000 Z
14
+ date: 2013-07-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gherkin-ruby
@@ -173,6 +173,7 @@ files:
173
173
  - CHANGELOG.md
174
174
  - Gemfile
175
175
  - Guardfile
176
+ - LICENSE
176
177
  - README.markdown
177
178
  - Rakefile
178
179
  - bin/spinach
@@ -183,6 +184,7 @@ files:
183
184
  - features/exit_status.feature
184
185
  - features/fail_fast.feature
185
186
  - features/feature_name_guessing.feature
187
+ - features/pending_steps.feature
186
188
  - features/reporting/customized_reporter.feature
187
189
  - features/reporting/display_run_summary.feature
188
190
  - features/reporting/error_reporting.feature
@@ -197,6 +199,7 @@ files:
197
199
  - features/steps/exit_status.rb
198
200
  - features/steps/fail_fast_option.rb
199
201
  - features/steps/feature_name_guessing.rb
202
+ - features/steps/pending_steps.rb
200
203
  - features/steps/reporting/display_run_summary.rb
201
204
  - features/steps/reporting/error_reporting.rb
202
205
  - features/steps/reporting/pending_feature_reporting.rb
@@ -302,6 +305,7 @@ test_files:
302
305
  - features/exit_status.feature
303
306
  - features/fail_fast.feature
304
307
  - features/feature_name_guessing.feature
308
+ - features/pending_steps.feature
305
309
  - features/reporting/customized_reporter.feature
306
310
  - features/reporting/display_run_summary.feature
307
311
  - features/reporting/error_reporting.feature
@@ -316,6 +320,7 @@ test_files:
316
320
  - features/steps/exit_status.rb
317
321
  - features/steps/fail_fast_option.rb
318
322
  - features/steps/feature_name_guessing.rb
323
+ - features/steps/pending_steps.rb
319
324
  - features/steps/reporting/display_run_summary.rb
320
325
  - features/steps/reporting/error_reporting.rb
321
326
  - features/steps/reporting/pending_feature_reporting.rb
@@ -357,3 +362,4 @@ test_files:
357
362
  - test/spinach_test.rb
358
363
  - test/support/filesystem.rb
359
364
  - test/test_helper.rb
365
+ has_rdoc: