spinach 0.7.0 → 0.8.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/.rvmrc +1 -1
- data/.travis.yml +1 -2
- data/CHANGELOG.md +46 -0
- data/README.markdown +15 -2
- data/features/steps/reporting/display_run_summary.rb +2 -0
- data/features/support/filesystem.rb +2 -2
- data/lib/spinach/cli.rb +3 -6
- data/lib/spinach/generators.rb +2 -2
- data/lib/spinach/generators/feature_generator.rb +2 -2
- data/lib/spinach/reporter.rb +1 -0
- data/lib/spinach/reporter/progress.rb +155 -0
- data/lib/spinach/reporter/stdout.rb +0 -10
- data/lib/spinach/reporter/stdout/error_reporting.rb +16 -3
- data/lib/spinach/runner/scenario_runner.rb +1 -3
- data/lib/spinach/version.rb +1 -1
- data/spinach.gemspec +3 -3
- data/test/spinach/cli_test.rb +7 -2
- data/test/spinach/generators/feature_generator_test.rb +3 -0
- data/test/spinach/generators_test.rb +11 -36
- data/test/spinach/reporter/progress_test.rb +167 -0
- data/test/spinach/reporter/stdout/error_reporting_test.rb +1 -1
- data/test/spinach/reporter/stdout_test.rb +2 -2
- data/test/spinach/runner/scenario_runner_test.rb +2 -2
- metadata +58 -48
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm --create use
|
1
|
+
rvm --create use 2.0.0@spinach
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
== 0.8.0
|
2
|
+
|
3
|
+
* backwards incompatible changes
|
4
|
+
* Pending steps no longer exit with -1
|
5
|
+
|
6
|
+
* bug fix
|
7
|
+
* Nothing
|
8
|
+
|
9
|
+
* enhancements
|
10
|
+
* Add CHANGELOG
|
11
|
+
* Add progress reporter
|
12
|
+
* Add official ruby 2.0.0 support
|
13
|
+
|
14
|
+
* deprecations
|
15
|
+
* Nothing
|
16
|
+
|
17
|
+
== 0.7.0
|
18
|
+
|
19
|
+
* backwards incompatible changes
|
20
|
+
* Nothing
|
21
|
+
|
22
|
+
* bug fix
|
23
|
+
* Nothing
|
24
|
+
|
25
|
+
* enhancements
|
26
|
+
* Steps are now generated with the `step` keyword instead of `Given`, `When`, `Then`, etc..
|
27
|
+
* Generated features are namespaced to the `Spinach::Features` to prevent conflicts.
|
28
|
+
|
29
|
+
* deprecations
|
30
|
+
* Nothing
|
31
|
+
|
32
|
+
== 0.6.1
|
33
|
+
|
34
|
+
* backwards incompatible changes
|
35
|
+
* Nothing
|
36
|
+
|
37
|
+
* bug fix
|
38
|
+
* Don't run entire test suite when an inexisting feature file is given.
|
39
|
+
* Run all features from given args instead of just the first one.
|
40
|
+
* Don't run tests when the `--generate` flag is given.
|
41
|
+
|
42
|
+
* enhancements
|
43
|
+
* Add docs on how to use shared steps.
|
44
|
+
|
45
|
+
* deprecations
|
46
|
+
* Nothing
|
data/README.markdown
CHANGED
@@ -12,8 +12,8 @@ Conceived as an alternative to Cucumber, here are some of its design goals:
|
|
12
12
|
* Step reusability: In case you want to reuse steps across features, you can
|
13
13
|
always wrap those in plain ol' Ruby modules.
|
14
14
|
|
15
|
-
Spinach is tested against MRI 1.9.2
|
16
|
-
works.
|
15
|
+
Spinach is tested against **MRI 1.9.3 and 2.0.0**. Rubinius 2.0 support
|
16
|
+
is on the works.
|
17
17
|
|
18
18
|
We are not planning to make it compatible with MRI 1.8.7 since, you know, this
|
19
19
|
would be irresponsible :)
|
@@ -314,6 +314,19 @@ class Spinach::Features::SessionTimeout < Spinach::FeatureSteps
|
|
314
314
|
end
|
315
315
|
```
|
316
316
|
|
317
|
+
## Reporters
|
318
|
+
|
319
|
+
Spinach supports two kinds of reporters by default: `stdout` and `progress`.
|
320
|
+
You can specify them when calling the `spinach` binary:
|
321
|
+
|
322
|
+
spinach --reporter progress
|
323
|
+
|
324
|
+
When no reporter is specified, `stdout` will be used by default.
|
325
|
+
|
326
|
+
For a console reporter with no colors, try:
|
327
|
+
|
328
|
+
* [spinach-console-reporter](https://github.com/ywen/spinach-console-reporter) (to be used with Jenkins)
|
329
|
+
|
317
330
|
## Wanna use it with Rails 3?
|
318
331
|
|
319
332
|
Use [spinach-rails](http://github.com/codegram/spinach-rails)
|
@@ -60,8 +60,8 @@ module Filesystem
|
|
60
60
|
wout.close
|
61
61
|
werr.close
|
62
62
|
|
63
|
-
@stdout = rout.readlines.join("\n")
|
64
|
-
@stderr = rerr.readlines.join("\n")
|
63
|
+
@stdout = rout.readlines.join("\n").force_encoding('utf-8')
|
64
|
+
@stderr = rerr.readlines.join("\n").force_encoding('utf-8')
|
65
65
|
|
66
66
|
# dispose the read ends of the pipes
|
67
67
|
rout.close
|
data/lib/spinach/cli.rb
CHANGED
@@ -22,12 +22,9 @@ module Spinach
|
|
22
22
|
def run
|
23
23
|
options
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
else
|
29
|
-
Spinach::Runner.new(feature_files).run
|
30
|
-
end
|
25
|
+
return true if Spinach.config.generate
|
26
|
+
|
27
|
+
Spinach::Runner.new(feature_files).run
|
31
28
|
end
|
32
29
|
|
33
30
|
# @return [Hash]
|
data/lib/spinach/generators.rb
CHANGED
@@ -70,12 +70,12 @@ module Spinach
|
|
70
70
|
#
|
71
71
|
def store
|
72
72
|
if File.exists?(filename_with_path)
|
73
|
-
raise FeatureGeneratorException.new("File already exists")
|
73
|
+
raise FeatureGeneratorException.new("File #{filename_with_path} already exists.")
|
74
74
|
else
|
75
75
|
FileUtils.mkdir_p path
|
76
76
|
File.open(filename_with_path, 'w') do |file|
|
77
77
|
file.write(generate)
|
78
|
-
puts "
|
78
|
+
puts "Generating #{File.basename(filename_with_path)}"
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
data/lib/spinach/reporter.rb
CHANGED
@@ -0,0 +1,155 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require_relative 'stdout/error_reporting'
|
3
|
+
|
4
|
+
module Spinach
|
5
|
+
class Reporter
|
6
|
+
# The Progress reporter outputs the runner results to the standard output
|
7
|
+
#
|
8
|
+
class Progress < Reporter
|
9
|
+
|
10
|
+
include Stdout::ErrorReporting
|
11
|
+
|
12
|
+
# The output buffers to store the reports.
|
13
|
+
attr_reader :out, :error
|
14
|
+
|
15
|
+
# The last scenario error
|
16
|
+
attr_accessor :scenario_error
|
17
|
+
|
18
|
+
# The last scenario
|
19
|
+
attr_accessor :scenario
|
20
|
+
|
21
|
+
# Initialitzes the runner
|
22
|
+
#
|
23
|
+
# @param [Hash] options
|
24
|
+
# Sets a custom output buffer by setting options[:output]
|
25
|
+
# Sets a custom error buffer by setting options[:error]
|
26
|
+
#
|
27
|
+
def initialize(*args)
|
28
|
+
super(*args)
|
29
|
+
@out = options[:output] || $stdout
|
30
|
+
@error = options[:error] || $stderr
|
31
|
+
end
|
32
|
+
|
33
|
+
# Adds a passed step to the output buffer.
|
34
|
+
#
|
35
|
+
# @param [Step] step
|
36
|
+
# The step.
|
37
|
+
#
|
38
|
+
# @param [Array] step_location
|
39
|
+
# The step source location
|
40
|
+
#
|
41
|
+
def on_successful_step(step, step_location, step_definitions = nil)
|
42
|
+
output_step('.', :green)
|
43
|
+
self.scenario = [current_feature, current_scenario, step]
|
44
|
+
successful_steps << scenario
|
45
|
+
end
|
46
|
+
|
47
|
+
# Adds a failing step to the output buffer.
|
48
|
+
#
|
49
|
+
# @param [Hash] step
|
50
|
+
# The step in a JSON Gherkin format
|
51
|
+
#
|
52
|
+
# @param [Exception] failure
|
53
|
+
# The exception that caused the failure
|
54
|
+
#
|
55
|
+
def on_failed_step(step, failure, step_location, step_definitions = nil)
|
56
|
+
output_step('F', :red)
|
57
|
+
self.scenario_error = [current_feature, current_scenario, step, failure]
|
58
|
+
failed_steps << scenario_error
|
59
|
+
end
|
60
|
+
|
61
|
+
# Adds a step that has raised an error to the output buffer.
|
62
|
+
#
|
63
|
+
# @param [Hash] step
|
64
|
+
# The step in a JSON Gherkin format
|
65
|
+
#
|
66
|
+
# @param [Exception] failure
|
67
|
+
# The exception that caused the failure
|
68
|
+
#
|
69
|
+
def on_error_step(step, failure, step_location, step_definitions = nil)
|
70
|
+
output_step('E', :red)
|
71
|
+
self.scenario_error = [current_feature, current_scenario, step, failure]
|
72
|
+
error_steps << scenario_error
|
73
|
+
end
|
74
|
+
|
75
|
+
# Adds an undefined step to the output buffer.
|
76
|
+
#
|
77
|
+
# @param [Hash] step
|
78
|
+
# The step in a JSON Gherkin format
|
79
|
+
#
|
80
|
+
def on_undefined_step(step, failure, step_definitions = nil)
|
81
|
+
output_step('U', :yellow)
|
82
|
+
self.scenario_error = [current_feature, current_scenario, step, failure]
|
83
|
+
undefined_steps << scenario_error
|
84
|
+
end
|
85
|
+
|
86
|
+
# Adds an undefined step to the output buffer.
|
87
|
+
#
|
88
|
+
# @param [Hash] step
|
89
|
+
# The step in a JSON Gherkin format
|
90
|
+
#
|
91
|
+
def on_pending_step(step, failure)
|
92
|
+
output_step('P', :yellow)
|
93
|
+
self.scenario_error = [current_feature, current_scenario, step, failure]
|
94
|
+
pending_steps << scenario_error
|
95
|
+
end
|
96
|
+
|
97
|
+
# Adds a step that has been skipped to the output buffer.
|
98
|
+
#
|
99
|
+
# @param [Hash] step
|
100
|
+
# The step that Gherkin extracts
|
101
|
+
#
|
102
|
+
def on_skipped_step(step, step_definitions = nil)
|
103
|
+
output_step('~', :cyan)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Adds to the output buffer a step result
|
107
|
+
#
|
108
|
+
# @param [String] text
|
109
|
+
# A symbol to prepend before the step keyword (might be useful to
|
110
|
+
# indicate if everything went ok or not).
|
111
|
+
#
|
112
|
+
# @param [Symbol] color
|
113
|
+
# The color code to use with Colorize to colorize the output.
|
114
|
+
#
|
115
|
+
def output_step(text, color = :grey)
|
116
|
+
out.print(text.to_s.colorize(color))
|
117
|
+
end
|
118
|
+
|
119
|
+
# It prints the error summary if the run has failed
|
120
|
+
# It always print feature success summary
|
121
|
+
#
|
122
|
+
# @param [True,False] success
|
123
|
+
# whether the run has succeed or not
|
124
|
+
#
|
125
|
+
def after_run(success)
|
126
|
+
error_summary unless success
|
127
|
+
out.puts ""
|
128
|
+
run_summary
|
129
|
+
end
|
130
|
+
|
131
|
+
# Prints the feature success summary for this run.
|
132
|
+
#
|
133
|
+
def run_summary
|
134
|
+
successful_summary = format_summary(:green, successful_steps, 'Successful')
|
135
|
+
undefined_summary = format_summary(:yellow, undefined_steps, 'Undefined')
|
136
|
+
pending_summary = format_summary(:yellow, pending_steps, 'Pending')
|
137
|
+
failed_summary = format_summary(:red, failed_steps, 'Failed')
|
138
|
+
error_summary = format_summary(:red, error_steps, 'Error')
|
139
|
+
|
140
|
+
out.puts "Steps Summary: #{successful_summary}, #{undefined_summary}, #{pending_summary}, #{failed_summary}, #{error_summary}\n\n"
|
141
|
+
end
|
142
|
+
|
143
|
+
private
|
144
|
+
def format_summary(color, steps, message)
|
145
|
+
buffer = []
|
146
|
+
buffer << "(".colorize(color)
|
147
|
+
buffer << steps.length.to_s.colorize(:"light_#{color}")
|
148
|
+
buffer << ") ".colorize(color)
|
149
|
+
buffer << message.colorize(color)
|
150
|
+
buffer.join
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
@@ -216,17 +216,7 @@ module Spinach
|
|
216
216
|
out.puts "Steps Summary: #{successful_summary}, #{undefined_summary}, #{pending_summary}, #{failed_summary}, #{error_summary}\n\n"
|
217
217
|
end
|
218
218
|
|
219
|
-
# Constructs the full step definition
|
220
|
-
#
|
221
|
-
# @param [Hash] step
|
222
|
-
# The step.
|
223
|
-
#
|
224
|
-
def full_step(step)
|
225
|
-
"#{step.keyword} #{step.name}"
|
226
|
-
end
|
227
|
-
|
228
219
|
private
|
229
|
-
|
230
220
|
def indent(n = 1)
|
231
221
|
" " * n
|
232
222
|
end
|
@@ -24,11 +24,17 @@ module Spinach
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def report_undefined_steps
|
27
|
-
|
27
|
+
if undefined_steps.any?
|
28
|
+
error.puts "\nUndefined steps summary:\n"
|
29
|
+
report_errors('Undefined steps', undefined_steps, :yellow)
|
30
|
+
end
|
28
31
|
end
|
29
32
|
|
30
33
|
def report_pending_steps
|
31
|
-
|
34
|
+
if pending_steps.any?
|
35
|
+
error.puts "\nPending steps summary:\n"
|
36
|
+
report_errors('Pending steps', pending_steps, :yellow)
|
37
|
+
end
|
32
38
|
end
|
33
39
|
|
34
40
|
def report_undefined_features
|
@@ -141,7 +147,6 @@ module Spinach
|
|
141
147
|
output
|
142
148
|
end
|
143
149
|
|
144
|
-
|
145
150
|
# Prints a information when an exception is raised.
|
146
151
|
#
|
147
152
|
# @param [Exception] exception
|
@@ -164,6 +169,14 @@ module Spinach
|
|
164
169
|
end
|
165
170
|
end
|
166
171
|
|
172
|
+
# Constructs the full step definition
|
173
|
+
#
|
174
|
+
# @param [Hash] step
|
175
|
+
# The step.
|
176
|
+
#
|
177
|
+
def full_step(step)
|
178
|
+
"#{step.keyword} #{step.name}"
|
179
|
+
end
|
167
180
|
end
|
168
181
|
end
|
169
182
|
end
|
@@ -84,13 +84,11 @@ 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
|
-
|
88
|
-
Spinach.hooks.run_on_pending_step step, @exception
|
87
|
+
Spinach.hooks.run_on_pending_step step, e
|
89
88
|
rescue Exception => e
|
90
89
|
@exception = e
|
91
90
|
Spinach.hooks.run_on_error_step step, @exception, step_location, step_definitions
|
92
91
|
end
|
93
|
-
|
94
92
|
end
|
95
93
|
end
|
96
94
|
end
|
data/lib/spinach/version.rb
CHANGED
data/spinach.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.summary = %q{Spinach is a BDD framework on top of gherkin}
|
10
10
|
gem.homepage = "http://github.com/codegram/spinach"
|
11
11
|
|
12
|
-
gem.add_runtime_dependency 'gherkin-ruby', '~> 0.2.
|
13
|
-
gem.add_runtime_dependency 'colorize'
|
12
|
+
gem.add_runtime_dependency 'gherkin-ruby', '~> 0.2.1'
|
13
|
+
gem.add_runtime_dependency 'colorize', '0.5.8'
|
14
14
|
gem.add_development_dependency 'rake'
|
15
15
|
gem.add_development_dependency 'mocha'
|
16
16
|
gem.add_development_dependency 'sinatra'
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_development_dependency 'pry'
|
19
19
|
gem.add_development_dependency 'simplecov'
|
20
20
|
gem.add_development_dependency 'rspec'
|
21
|
-
gem.add_development_dependency 'minitest'
|
21
|
+
gem.add_development_dependency 'minitest'
|
22
22
|
gem.add_development_dependency 'turn'
|
23
23
|
|
24
24
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
data/test/spinach/cli_test.rb
CHANGED
@@ -142,9 +142,14 @@ tags:
|
|
142
142
|
describe 'generate' do
|
143
143
|
%w{-g --generate}.each do |opt|
|
144
144
|
it 'inits the generator if #{opt}' do
|
145
|
+
config = Spinach::Config.new
|
146
|
+
Spinach.stubs(:config).returns(config)
|
147
|
+
|
145
148
|
Spinach::Generators.expects(:run)
|
146
|
-
|
147
|
-
|
149
|
+
|
150
|
+
Spinach::Cli.new([opt]).run
|
151
|
+
|
152
|
+
config.generate.must_equal true
|
148
153
|
end
|
149
154
|
end
|
150
155
|
end
|
@@ -83,11 +83,14 @@ Feature: Cheezburger can I has
|
|
83
83
|
file = "features/steps/cheezburger_can_i_has.rb"
|
84
84
|
in_current_dir do
|
85
85
|
FileUtils.mkdir_p "features/steps"
|
86
|
+
|
86
87
|
File.open(file, 'w') do |f|
|
87
88
|
f.write("Fake content")
|
88
89
|
end
|
90
|
+
|
89
91
|
Proc.new{subject.store}.must_raise(
|
90
92
|
Spinach::Generators::FeatureGeneratorException)
|
93
|
+
|
91
94
|
FileUtils.rm_rf("features/steps")
|
92
95
|
end
|
93
96
|
end
|
@@ -5,48 +5,23 @@ describe Spinach::Generators do
|
|
5
5
|
Spinach::Generators
|
6
6
|
end
|
7
7
|
|
8
|
-
let(:data) do
|
9
|
-
Spinach::Parser.new("""
|
10
|
-
Feature: Cheezburger can I has
|
11
|
-
Background:
|
12
|
-
Given I liek cheezburger
|
13
|
-
Scenario: Some Lulz
|
14
|
-
Given I haz a sad
|
15
|
-
When I get some lulz
|
16
|
-
Then I haz a happy
|
17
|
-
Scenario: Some sad
|
18
|
-
Given I haz a happy
|
19
|
-
When I get some lulz
|
20
|
-
Then I am OMG ROFLMAO""").parse
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#bind" do
|
24
|
-
it "binds the generator to the missing feature hook" do
|
25
|
-
subject.expects(:generate_feature).with(data)
|
26
|
-
subject.bind
|
27
|
-
Spinach.hooks.run_on_undefined_feature data
|
28
|
-
Spinach.hooks.reset
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
8
|
describe "#generate_feature" do
|
33
|
-
it "generates a file" do
|
34
|
-
feature_data = data
|
35
|
-
in_current_dir do
|
36
|
-
subject.generate_feature(feature_data)
|
37
|
-
File.exists?("features/steps/cheezburger_can_i_has.rb").must_equal true
|
38
|
-
FileUtils.rm_rf("features/steps")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
9
|
it "outputs a message if feature cannot be generated" do
|
43
10
|
in_current_dir do
|
44
|
-
|
11
|
+
FileUtils.mkdir_p "features/steps"
|
12
|
+
|
13
|
+
File.open('features/steps/cheezburger_can_i_has.rb', 'w') do |f|
|
14
|
+
f.write("Feature: Fake feature")
|
15
|
+
end
|
16
|
+
|
17
|
+
Spinach::Generators::FeatureGenerator.any_instance.expects(:store).raises(
|
45
18
|
Spinach::Generators::FeatureGeneratorException.new("File already exists"))
|
19
|
+
|
46
20
|
capture_stdout do
|
47
|
-
subject.
|
21
|
+
subject.run(["features/steps/cheezburger_can_i_has.rb"])
|
48
22
|
end.must_include "File already exists"
|
49
|
-
|
23
|
+
|
24
|
+
FileUtils.rm_rf("features/steps")
|
50
25
|
end
|
51
26
|
end
|
52
27
|
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../../test_helper'
|
4
|
+
|
5
|
+
describe Spinach::Reporter::Progress do
|
6
|
+
let(:exception) { StandardError.new('Something went wrong') }
|
7
|
+
|
8
|
+
let(:error) do
|
9
|
+
[stub(name: 'My feature'),
|
10
|
+
stub(name: 'A scenario'),
|
11
|
+
stub(keyword: 'Keyword', name: 'step name'),
|
12
|
+
exception]
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:steps) do
|
16
|
+
[error]
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
before do
|
21
|
+
@out = StringIO.new
|
22
|
+
@error = StringIO.new
|
23
|
+
@reporter = Spinach::Reporter::Progress.new(
|
24
|
+
output: @out,
|
25
|
+
error: @error
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#on_successful_step' do
|
30
|
+
let(:step) { stub(keyword: 'Given', name: 'I am too cool') }
|
31
|
+
let(:step_location){['error_step_location', 1]}
|
32
|
+
let(:step_definitions){ stub }
|
33
|
+
|
34
|
+
it 'adds the step to the output buffer' do
|
35
|
+
@reporter.on_successful_step(step, step_location)
|
36
|
+
|
37
|
+
@out.string.must_include '.'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'sets the current scenario' do
|
41
|
+
@reporter.on_successful_step(step, step_location)
|
42
|
+
|
43
|
+
@reporter.scenario.must_include step
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'adds the step to the successful steps' do
|
47
|
+
@reporter.on_successful_step(step, step_location)
|
48
|
+
|
49
|
+
@reporter.successful_steps.last.must_include step
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#on_failed_step' do
|
54
|
+
let(:step) { stub(keyword: 'Then', name: 'I write failing steps') }
|
55
|
+
let(:step_location){['error_step_location', 1]}
|
56
|
+
|
57
|
+
it 'adds the step to the output buffer' do
|
58
|
+
@reporter.on_failed_step(step, anything, step_location)
|
59
|
+
|
60
|
+
@out.string.must_include 'F'
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'sets the current scenario error' do
|
64
|
+
@reporter.on_failed_step(step, anything, step_location)
|
65
|
+
|
66
|
+
@reporter.scenario_error.must_include step
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'adds the step to the failing steps' do
|
70
|
+
@reporter.on_failed_step(step, anything, step_location)
|
71
|
+
|
72
|
+
@reporter.failed_steps.last.must_include step
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#on_error_step' do
|
77
|
+
let(:step) { stub(keyword: 'And', name: 'I even make syntax errors') }
|
78
|
+
let(:step_location){['error_step_location', 1]}
|
79
|
+
|
80
|
+
it 'adds the step to the output buffer' do
|
81
|
+
@reporter.on_error_step(step, anything, step_location)
|
82
|
+
|
83
|
+
@out.string.must_include 'E'
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'sets the current scenario error' do
|
87
|
+
@reporter.on_error_step(step, anything, step_location)
|
88
|
+
@reporter.scenario_error.must_include step
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'adds the step to the error steps' do
|
92
|
+
@reporter.on_error_step(step, anything, step_location)
|
93
|
+
@reporter.error_steps.last.must_include step
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '#on_undefined_step' do
|
98
|
+
let(:step) { stub(keyword: 'When', name: 'I forgot to write steps') }
|
99
|
+
|
100
|
+
it 'adds the step to the output buffer' do
|
101
|
+
@reporter.on_undefined_step(step, anything)
|
102
|
+
|
103
|
+
@out.string.must_include 'U'
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'sets the current scenario error' do
|
107
|
+
@reporter.on_undefined_step(step, anything)
|
108
|
+
|
109
|
+
@reporter.scenario_error.must_include step
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'adds the step to the undefined steps' do
|
113
|
+
@reporter.on_undefined_step(step, anything)
|
114
|
+
|
115
|
+
@reporter.undefined_steps.last.must_include step
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe '#on_pending_step' do
|
120
|
+
let(:step) { stub(keyword: 'Given', name: 'I wrote a pending step') }
|
121
|
+
|
122
|
+
it 'adds the step to the output buffer' do
|
123
|
+
@reporter.on_pending_step(step, anything)
|
124
|
+
|
125
|
+
@out.string.must_include 'P'
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'sets the current scenario error' do
|
129
|
+
@reporter.on_pending_step(step, anything)
|
130
|
+
@reporter.scenario_error.must_include step
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'adds the step to the pending steps' do
|
134
|
+
@reporter.on_pending_step(step, anything)
|
135
|
+
@reporter.pending_steps.last.must_include step
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#on_skipped_step' do
|
140
|
+
it 'adds the step to the output buffer' do
|
141
|
+
@reporter.on_skipped_step(stub(keyword: 'Then', name: 'some steps are not even called'))
|
142
|
+
|
143
|
+
@out.string.must_include '~'
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
describe '#after_run' do
|
148
|
+
describe 'when the run has succeed' do
|
149
|
+
it 'display run summary' do
|
150
|
+
@reporter.expects(:error_summary).never
|
151
|
+
@reporter.expects(:run_summary)
|
152
|
+
|
153
|
+
@reporter.after_run(true)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe 'when the run has failed' do
|
158
|
+
it 'display run and error summaries' do
|
159
|
+
@reporter.expects(:error_summary)
|
160
|
+
@reporter.expects(:run_summary)
|
161
|
+
|
162
|
+
@reporter.after_run(false)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
@@ -149,9 +149,9 @@ module Spinach
|
|
149
149
|
raises Spinach::StepPendingException, @step
|
150
150
|
end
|
151
151
|
|
152
|
-
it '
|
152
|
+
it 'does not set the exception' do
|
153
153
|
subject.run_step(@step)
|
154
|
-
subject.instance_variable_get(:@exception).must_be_kind_of(
|
154
|
+
subject.instance_variable_get(:@exception).must_be_kind_of(NilClass)
|
155
155
|
end
|
156
156
|
|
157
157
|
it 'runs the pending hooks' do
|
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.
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,184 +12,184 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2013-03-03 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: gherkin-ruby
|
19
|
-
prerelease: false
|
20
19
|
requirement: !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
21
|
requirements:
|
22
22
|
- - ~>
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 0.2.
|
25
|
-
none: false
|
24
|
+
version: 0.2.1
|
26
25
|
type: :runtime
|
26
|
+
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
28
29
|
requirements:
|
29
30
|
- - ~>
|
30
31
|
- !ruby/object:Gem::Version
|
31
|
-
version: 0.2.
|
32
|
-
none: false
|
32
|
+
version: 0.2.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: colorize
|
35
|
-
prerelease: false
|
36
35
|
requirement: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
41
|
-
none: false
|
40
|
+
version: 0.5.8
|
42
41
|
type: :runtime
|
42
|
+
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
44
45
|
requirements:
|
45
|
-
- -
|
46
|
+
- - '='
|
46
47
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
none: false
|
48
|
+
version: 0.5.8
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rake
|
51
|
-
prerelease: false
|
52
51
|
requirement: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
|
-
none: false
|
58
57
|
type: :development
|
58
|
+
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
60
61
|
requirements:
|
61
62
|
- - ! '>='
|
62
63
|
- !ruby/object:Gem::Version
|
63
64
|
version: '0'
|
64
|
-
none: false
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
66
|
name: mocha
|
67
|
-
prerelease: false
|
68
67
|
requirement: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
69
|
requirements:
|
70
70
|
- - ! '>='
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0'
|
73
|
-
none: false
|
74
73
|
type: :development
|
74
|
+
prerelease: false
|
75
75
|
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
76
77
|
requirements:
|
77
78
|
- - ! '>='
|
78
79
|
- !ruby/object:Gem::Version
|
79
80
|
version: '0'
|
80
|
-
none: false
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: sinatra
|
83
|
-
prerelease: false
|
84
83
|
requirement: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
85
|
requirements:
|
86
86
|
- - ! '>='
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
|
-
none: false
|
90
89
|
type: :development
|
90
|
+
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
92
93
|
requirements:
|
93
94
|
- - ! '>='
|
94
95
|
- !ruby/object:Gem::Version
|
95
96
|
version: '0'
|
96
|
-
none: false
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: capybara
|
99
|
-
prerelease: false
|
100
99
|
requirement: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
101
|
requirements:
|
102
102
|
- - ~>
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: 2.0.0
|
105
|
-
none: false
|
106
105
|
type: :development
|
106
|
+
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
108
109
|
requirements:
|
109
110
|
- - ~>
|
110
111
|
- !ruby/object:Gem::Version
|
111
112
|
version: 2.0.0
|
112
|
-
none: false
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: pry
|
115
|
-
prerelease: false
|
116
115
|
requirement: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
|
-
none: false
|
122
121
|
type: :development
|
122
|
+
prerelease: false
|
123
123
|
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
124
125
|
requirements:
|
125
126
|
- - ! '>='
|
126
127
|
- !ruby/object:Gem::Version
|
127
128
|
version: '0'
|
128
|
-
none: false
|
129
129
|
- !ruby/object:Gem::Dependency
|
130
130
|
name: simplecov
|
131
|
-
prerelease: false
|
132
131
|
requirement: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
133
|
requirements:
|
134
134
|
- - ! '>='
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
|
-
none: false
|
138
137
|
type: :development
|
138
|
+
prerelease: false
|
139
139
|
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
140
141
|
requirements:
|
141
142
|
- - ! '>='
|
142
143
|
- !ruby/object:Gem::Version
|
143
144
|
version: '0'
|
144
|
-
none: false
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: rspec
|
147
|
-
prerelease: false
|
148
147
|
requirement: !ruby/object:Gem::Requirement
|
148
|
+
none: false
|
149
149
|
requirements:
|
150
150
|
- - ! '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
none: false
|
154
153
|
type: :development
|
154
|
+
prerelease: false
|
155
155
|
version_requirements: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
156
157
|
requirements:
|
157
158
|
- - ! '>='
|
158
159
|
- !ruby/object:Gem::Version
|
159
160
|
version: '0'
|
160
|
-
none: false
|
161
161
|
- !ruby/object:Gem::Dependency
|
162
162
|
name: minitest
|
163
|
-
prerelease: false
|
164
163
|
requirement: !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
165
|
requirements:
|
166
|
-
- - '
|
166
|
+
- - ! '>='
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
169
|
-
none: false
|
168
|
+
version: '0'
|
170
169
|
type: :development
|
170
|
+
prerelease: false
|
171
171
|
version_requirements: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
172
173
|
requirements:
|
173
|
-
- - '
|
174
|
+
- - ! '>='
|
174
175
|
- !ruby/object:Gem::Version
|
175
|
-
version:
|
176
|
-
none: false
|
176
|
+
version: '0'
|
177
177
|
- !ruby/object:Gem::Dependency
|
178
178
|
name: turn
|
179
|
-
prerelease: false
|
180
179
|
requirement: !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
181
181
|
requirements:
|
182
182
|
- - ! '>='
|
183
183
|
- !ruby/object:Gem::Version
|
184
184
|
version: '0'
|
185
|
-
none: false
|
186
185
|
type: :development
|
186
|
+
prerelease: false
|
187
187
|
version_requirements: !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
188
189
|
requirements:
|
189
190
|
- - ! '>='
|
190
191
|
- !ruby/object:Gem::Version
|
191
192
|
version: '0'
|
192
|
-
none: false
|
193
193
|
description: Spinach is a BDD framework on top of gherkin
|
194
194
|
email:
|
195
195
|
- info@codegram.com
|
@@ -206,6 +206,7 @@ files:
|
|
206
206
|
- .gitignore
|
207
207
|
- .rvmrc
|
208
208
|
- .travis.yml
|
209
|
+
- CHANGELOG.md
|
209
210
|
- Gemfile
|
210
211
|
- Guardfile
|
211
212
|
- README.markdown
|
@@ -263,6 +264,7 @@ files:
|
|
263
264
|
- lib/spinach/parser.rb
|
264
265
|
- lib/spinach/parser/visitor.rb
|
265
266
|
- lib/spinach/reporter.rb
|
267
|
+
- lib/spinach/reporter/progress.rb
|
266
268
|
- lib/spinach/reporter/stdout.rb
|
267
269
|
- lib/spinach/reporter/stdout/error_reporting.rb
|
268
270
|
- lib/spinach/runner.rb
|
@@ -290,6 +292,7 @@ files:
|
|
290
292
|
- test/spinach/hooks_test.rb
|
291
293
|
- test/spinach/parser/visitor_test.rb
|
292
294
|
- test/spinach/parser_test.rb
|
295
|
+
- test/spinach/reporter/progress_test.rb
|
293
296
|
- test/spinach/reporter/stdout/error_reporting_test.rb
|
294
297
|
- test/spinach/reporter/stdout_test.rb
|
295
298
|
- test/spinach/reporter_test.rb
|
@@ -310,20 +313,26 @@ rdoc_options: []
|
|
310
313
|
require_paths:
|
311
314
|
- lib
|
312
315
|
required_ruby_version: !ruby/object:Gem::Requirement
|
316
|
+
none: false
|
313
317
|
requirements:
|
314
318
|
- - ! '>='
|
315
319
|
- !ruby/object:Gem::Version
|
316
320
|
version: '0'
|
317
|
-
|
321
|
+
segments:
|
322
|
+
- 0
|
323
|
+
hash: -4461356009493919756
|
318
324
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
325
|
+
none: false
|
319
326
|
requirements:
|
320
327
|
- - ! '>='
|
321
328
|
- !ruby/object:Gem::Version
|
322
329
|
version: '0'
|
323
|
-
|
330
|
+
segments:
|
331
|
+
- 0
|
332
|
+
hash: -4461356009493919756
|
324
333
|
requirements: []
|
325
334
|
rubyforge_project:
|
326
|
-
rubygems_version: 1.8.
|
335
|
+
rubygems_version: 1.8.25
|
327
336
|
signing_key:
|
328
337
|
specification_version: 3
|
329
338
|
summary: Spinach is a BDD framework on top of gherkin
|
@@ -374,6 +383,7 @@ test_files:
|
|
374
383
|
- test/spinach/hooks_test.rb
|
375
384
|
- test/spinach/parser/visitor_test.rb
|
376
385
|
- test/spinach/parser_test.rb
|
386
|
+
- test/spinach/reporter/progress_test.rb
|
377
387
|
- test/spinach/reporter/stdout/error_reporting_test.rb
|
378
388
|
- test/spinach/reporter/stdout_test.rb
|
379
389
|
- test/spinach/reporter_test.rb
|