spinach 0.8.1 → 0.8.2
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.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +4 -0
- data/Rakefile +1 -1
- data/lib/spinach/parser/visitor.rb +8 -8
- data/lib/spinach/parser.rb +3 -3
- data/lib/spinach/reporter/progress.rb +5 -5
- data/lib/spinach/reporter/stdout.rb +9 -9
- data/lib/spinach/runner/feature_runner.rb +2 -2
- data/lib/spinach/runner/scenario_runner.rb +4 -4
- data/lib/spinach/version.rb +1 -1
- data/lib/spinach.rb +1 -1
- data/spinach.gemspec +1 -1
- data/test/spinach/capybara_test.rb +8 -9
- data/test/spinach/parser_test.rb +1 -1
- metadata +7 -6
- data/.rvmrc +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b707d1189dcf7e14b981a5c71720a2c5e15535c
|
4
|
+
data.tar.gz: c446d9797269a2a2ac125a6a38f13b4afa8573c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cb1779c57669967a3996b12e99359af58029e0447614bc6b08e4d97b2ce9a38fa1b301cba09a27d6e71a51f6da8c45d742c91de1f3c3edc2782a1720afb0020
|
7
|
+
data.tar.gz: 56d2b4fa3ebf70c65e9d5b19306171cd0c6be991a62c234053b824f261287212aeaef3705c97a1e705602e3d2e7c4e6972cb1013a4404798bc2ed29eb3f37895
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
spinach
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Spinach
|
2
2
|
class Parser
|
3
|
-
# The Spinach Visitor traverses the output AST from the
|
3
|
+
# The Spinach Visitor traverses the output AST from the GherkinRuby parser and
|
4
4
|
# populates its Feature with all the scenarios, tags, steps, etc.
|
5
5
|
#
|
6
6
|
# @example
|
7
7
|
#
|
8
|
-
# ast =
|
8
|
+
# ast = GherkinRuby.parse(File.read('some.feature')
|
9
9
|
# visitor = Spinach::Parser::Visitor.new
|
10
10
|
# feature = visitor.visit(ast)
|
11
11
|
#
|
@@ -20,7 +20,7 @@ module Spinach
|
|
20
20
|
@feature = Feature.new
|
21
21
|
end
|
22
22
|
|
23
|
-
# @param [
|
23
|
+
# @param [GherkinRuby::AST::Feature] ast
|
24
24
|
# The AST root node to visit.
|
25
25
|
#
|
26
26
|
# @api public
|
@@ -31,7 +31,7 @@ module Spinach
|
|
31
31
|
|
32
32
|
# Sets the feature name and iterates over the feature scenarios.
|
33
33
|
#
|
34
|
-
# @param [
|
34
|
+
# @param [GherkinRuby::AST::Feature] feature
|
35
35
|
# The feature to visit.
|
36
36
|
#
|
37
37
|
# @api public
|
@@ -48,7 +48,7 @@ module Spinach
|
|
48
48
|
|
49
49
|
# Iterates over the steps.
|
50
50
|
#
|
51
|
-
# @param [
|
51
|
+
# @param [GherkinRuby::AST::Scenario] node
|
52
52
|
# The scenario to visit.
|
53
53
|
#
|
54
54
|
# @api public
|
@@ -65,7 +65,7 @@ module Spinach
|
|
65
65
|
|
66
66
|
# Sets the scenario name and iterates over the steps.
|
67
67
|
#
|
68
|
-
# @param [
|
68
|
+
# @param [GherkinRuby::AST::Scenario] node
|
69
69
|
# The scenario to visit.
|
70
70
|
#
|
71
71
|
# @api public
|
@@ -87,7 +87,7 @@ module Spinach
|
|
87
87
|
|
88
88
|
# Adds the tag to the current scenario.
|
89
89
|
#
|
90
|
-
# @param [
|
90
|
+
# @param [GherkinRuby::AST::Tag] node
|
91
91
|
# The tag to add.
|
92
92
|
#
|
93
93
|
# @api public
|
@@ -97,7 +97,7 @@ module Spinach
|
|
97
97
|
|
98
98
|
# Adds the step to the current scenario.
|
99
99
|
#
|
100
|
-
# @param [
|
100
|
+
# @param [GherkinRuby::AST::Step] step
|
101
101
|
# The step to add.
|
102
102
|
#
|
103
103
|
# @api public
|
data/lib/spinach/parser.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'gherkin_ruby'
|
2
2
|
require_relative 'parser/visitor'
|
3
3
|
|
4
4
|
module Spinach
|
5
|
-
# Parser leverages
|
5
|
+
# Parser leverages GherkinRuby to parse the feature definition.
|
6
6
|
#
|
7
7
|
class Parser
|
8
8
|
# @param [String] content
|
@@ -36,7 +36,7 @@ module Spinach
|
|
36
36
|
#
|
37
37
|
# @api public
|
38
38
|
def parse
|
39
|
-
ast =
|
39
|
+
ast = GherkinRuby.parse(@content + "\n")
|
40
40
|
Visitor.new.visit(ast)
|
41
41
|
end
|
42
42
|
end
|
@@ -37,7 +37,7 @@ module Spinach
|
|
37
37
|
# Adds a failing step to the output buffer.
|
38
38
|
#
|
39
39
|
# @param [Hash] step
|
40
|
-
# The step in a JSON
|
40
|
+
# The step in a JSON GherkinRuby format
|
41
41
|
#
|
42
42
|
# @param [Exception] failure
|
43
43
|
# The exception that caused the failure
|
@@ -51,7 +51,7 @@ module Spinach
|
|
51
51
|
# Adds a step that has raised an error to the output buffer.
|
52
52
|
#
|
53
53
|
# @param [Hash] step
|
54
|
-
# The step in a JSON
|
54
|
+
# The step in a JSON GherkinRuby format
|
55
55
|
#
|
56
56
|
# @param [Exception] failure
|
57
57
|
# The exception that caused the failure
|
@@ -65,7 +65,7 @@ module Spinach
|
|
65
65
|
# Adds an undefined step to the output buffer.
|
66
66
|
#
|
67
67
|
# @param [Hash] step
|
68
|
-
# The step in a JSON
|
68
|
+
# The step in a JSON GherkinRuby format
|
69
69
|
#
|
70
70
|
def on_undefined_step(step, failure, step_definitions = nil)
|
71
71
|
output_step('U', :yellow)
|
@@ -76,7 +76,7 @@ module Spinach
|
|
76
76
|
# Adds an undefined step to the output buffer.
|
77
77
|
#
|
78
78
|
# @param [Hash] step
|
79
|
-
# The step in a JSON
|
79
|
+
# The step in a JSON GherkinRuby format
|
80
80
|
#
|
81
81
|
def on_pending_step(step, failure)
|
82
82
|
output_step('P', :yellow)
|
@@ -87,7 +87,7 @@ module Spinach
|
|
87
87
|
# Adds a step that has been skipped to the output buffer.
|
88
88
|
#
|
89
89
|
# @param [Hash] step
|
90
|
-
# The step that
|
90
|
+
# The step that GherkinRuby extracts
|
91
91
|
#
|
92
92
|
def on_skipped_step(step, step_definitions = nil)
|
93
93
|
output_step('~', :cyan)
|
@@ -24,7 +24,7 @@ module Spinach
|
|
24
24
|
# Prints the feature name to the standard output
|
25
25
|
#
|
26
26
|
# @param [Hash] data
|
27
|
-
# The feature in a JSON
|
27
|
+
# The feature in a JSON GherkinRubyRuby format
|
28
28
|
#
|
29
29
|
def before_feature_run(feature)
|
30
30
|
name = feature.name
|
@@ -34,7 +34,7 @@ module Spinach
|
|
34
34
|
# Prints the scenario name to the standard ouput
|
35
35
|
#
|
36
36
|
# @param [Hash] data
|
37
|
-
# The feature in a JSON
|
37
|
+
# The feature in a JSON GherkinRubyRuby format
|
38
38
|
#
|
39
39
|
def before_scenario_run(scenario, step_definitions = nil)
|
40
40
|
@max_step_name_length = scenario.steps.map(&:name).map(&:length).max if scenario.steps.any?
|
@@ -45,7 +45,7 @@ module Spinach
|
|
45
45
|
# Adds an error report and re
|
46
46
|
#
|
47
47
|
# @param [Hash] data
|
48
|
-
# The feature in a JSON
|
48
|
+
# The feature in a JSON GherkinRubyRuby format
|
49
49
|
#
|
50
50
|
def after_scenario_run(scenario, step_definitions = nil)
|
51
51
|
if scenario_error
|
@@ -71,7 +71,7 @@ module Spinach
|
|
71
71
|
# Adds a failing step to the output buffer.
|
72
72
|
#
|
73
73
|
# @param [Hash] step
|
74
|
-
# The step in a JSON
|
74
|
+
# The step in a JSON GherkinRubyRuby format
|
75
75
|
#
|
76
76
|
# @param [Exception] failure
|
77
77
|
# The exception that caused the failure
|
@@ -85,7 +85,7 @@ module Spinach
|
|
85
85
|
# Adds a step that has raised an error to the output buffer.
|
86
86
|
#
|
87
87
|
# @param [Hash] step
|
88
|
-
# The step in a JSON
|
88
|
+
# The step in a JSON GherkinRubyRuby format
|
89
89
|
#
|
90
90
|
# @param [Exception] failure
|
91
91
|
# The exception that caused the failure
|
@@ -99,7 +99,7 @@ module Spinach
|
|
99
99
|
# Adds an undefined step to the output buffer.
|
100
100
|
#
|
101
101
|
# @param [Hash] step
|
102
|
-
# The step in a JSON
|
102
|
+
# The step in a JSON GherkinRubyRuby format
|
103
103
|
#
|
104
104
|
def on_undefined_step(step, failure, step_definitions = nil)
|
105
105
|
output_step('?', step, :yellow)
|
@@ -110,7 +110,7 @@ module Spinach
|
|
110
110
|
# Adds an undefined step to the output buffer.
|
111
111
|
#
|
112
112
|
# @param [Hash] step
|
113
|
-
# The step in a JSON
|
113
|
+
# The step in a JSON GherkinRubyRuby format
|
114
114
|
#
|
115
115
|
def on_pending_step(step, failure)
|
116
116
|
output_step('P', step, :yellow)
|
@@ -144,7 +144,7 @@ module Spinach
|
|
144
144
|
# Adds a step that has been skipped to the output buffer.
|
145
145
|
#
|
146
146
|
# @param [Hash] step
|
147
|
-
# The step that
|
147
|
+
# The step that GherkinRubyRuby extracts
|
148
148
|
#
|
149
149
|
def on_skipped_step(step, step_definitions = nil)
|
150
150
|
output_step('~', step, :cyan)
|
@@ -157,7 +157,7 @@ module Spinach
|
|
157
157
|
# indicate if everything went ok or not).
|
158
158
|
#
|
159
159
|
# @param [Hash] step
|
160
|
-
# The step in a JSON
|
160
|
+
# The step in a JSON GherkinRubyRuby format
|
161
161
|
#
|
162
162
|
# @param [Symbol] color
|
163
163
|
# The color code to use with Colorize to colorize the output.
|
@@ -7,7 +7,7 @@ module Spinach
|
|
7
7
|
class FeatureRunner
|
8
8
|
attr_reader :feature
|
9
9
|
|
10
|
-
# @param [
|
10
|
+
# @param [GherkinRuby::AST::Feature] feature
|
11
11
|
# The feature to run.
|
12
12
|
#
|
13
13
|
# @param [#to_i] line
|
@@ -28,7 +28,7 @@ module Spinach
|
|
28
28
|
@feature.name
|
29
29
|
end
|
30
30
|
|
31
|
-
# @return [Array<
|
31
|
+
# @return [Array<GherkinRuby::AST::Scenario>]
|
32
32
|
# The parsed scenarios for this runner's feature.
|
33
33
|
#
|
34
34
|
# @api public
|
@@ -3,7 +3,7 @@ module Spinach
|
|
3
3
|
# A Scenario Runner handles a particular scenario run.
|
4
4
|
#
|
5
5
|
class ScenarioRunner
|
6
|
-
# @param [
|
6
|
+
# @param [GherkinRuby::AST::Scenario] scenario
|
7
7
|
# The scenario.
|
8
8
|
#
|
9
9
|
# @api public
|
@@ -11,7 +11,7 @@ module Spinach
|
|
11
11
|
@scenario = scenario
|
12
12
|
end
|
13
13
|
|
14
|
-
# @return [
|
14
|
+
# @return [GherkinRuby::AST::Feature>]
|
15
15
|
# The feature containing the scenario.
|
16
16
|
#
|
17
17
|
# @api public
|
@@ -19,7 +19,7 @@ module Spinach
|
|
19
19
|
@scenario.feature
|
20
20
|
end
|
21
21
|
|
22
|
-
# @return [Array<
|
22
|
+
# @return [Array<GherkinRuby::AST::Step>]
|
23
23
|
# An array of steps.
|
24
24
|
#
|
25
25
|
# @api public
|
@@ -68,7 +68,7 @@ module Spinach
|
|
68
68
|
|
69
69
|
# Runs a particular step.
|
70
70
|
#
|
71
|
-
# @param [
|
71
|
+
# @param [GherkinRuby::AST::Step] step
|
72
72
|
# The step to be run.
|
73
73
|
#
|
74
74
|
# @api semipublic
|
data/lib/spinach/version.rb
CHANGED
data/lib/spinach.rb
CHANGED
@@ -18,7 +18,7 @@ require_relative 'spinach/features'
|
|
18
18
|
require_relative 'spinach/scenario'
|
19
19
|
require_relative 'spinach/step'
|
20
20
|
|
21
|
-
# Spinach is a BDD framework leveraging the great
|
21
|
+
# Spinach is a BDD framework leveraging the great GherkinRuby language. This
|
22
22
|
# language is the one used defining features in Cucumber, the BDD framework
|
23
23
|
# Spinach is inspired upon.
|
24
24
|
#
|
data/spinach.gemspec
CHANGED
@@ -9,7 +9,7 @@ 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.
|
12
|
+
gem.add_runtime_dependency 'gherkin-ruby', '~> 0.3.0'
|
13
13
|
gem.add_runtime_dependency 'colorize', '0.5.8'
|
14
14
|
gem.add_development_dependency 'rake'
|
15
15
|
gem.add_development_dependency 'mocha'
|
@@ -3,19 +3,18 @@ require 'capybara'
|
|
3
3
|
require 'rack/test'
|
4
4
|
require 'spinach'
|
5
5
|
require 'spinach/capybara'
|
6
|
-
require 'sinatra'
|
6
|
+
require 'sinatra/base'
|
7
|
+
|
8
|
+
class SinatraStubApp < Sinatra::Base
|
9
|
+
get '/' do
|
10
|
+
'Hello world!'
|
11
|
+
end
|
12
|
+
end
|
7
13
|
|
8
14
|
describe Spinach::FeatureSteps::Capybara do
|
9
15
|
before do
|
10
16
|
Capybara.current_driver = :rack_test
|
11
|
-
|
12
|
-
@sinatra_app = Sinatra::Application.new do
|
13
|
-
get '/' do
|
14
|
-
'Hello world!'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Capybara.app = @sinatra_app
|
17
|
+
Capybara.app = SinatraStubApp
|
19
18
|
|
20
19
|
class TestFeature < Spinach::FeatureSteps
|
21
20
|
include Spinach::FeatureSteps::Capybara
|
data/test/spinach/parser_test.rb
CHANGED
@@ -17,7 +17,7 @@ Feature: User authentication
|
|
17
17
|
|
18
18
|
describe '#parse' do
|
19
19
|
it 'parses the file' do
|
20
|
-
|
20
|
+
GherkinRuby.expects(:parse).returns ast = stub
|
21
21
|
Spinach::Parser::Visitor.stubs(:new).returns visitor = stub
|
22
22
|
visitor.expects(:visit).with ast
|
23
23
|
@parser.parse
|
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.
|
4
|
+
version: 0.8.2
|
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-
|
14
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: gherkin-ruby
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.3.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.3.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: colorize
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -181,7 +181,8 @@ extra_rdoc_files: []
|
|
181
181
|
files:
|
182
182
|
- .document
|
183
183
|
- .gitignore
|
184
|
-
- .
|
184
|
+
- .ruby-gemset
|
185
|
+
- .ruby-version
|
185
186
|
- .travis.yml
|
186
187
|
- CHANGELOG.md
|
187
188
|
- Gemfile
|
@@ -300,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
300
301
|
version: '0'
|
301
302
|
requirements: []
|
302
303
|
rubyforge_project:
|
303
|
-
rubygems_version: 2.0.
|
304
|
+
rubygems_version: 2.0.3
|
304
305
|
signing_key:
|
305
306
|
specification_version: 4
|
306
307
|
summary: Spinach is a BDD framework on top of gherkin
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm --create use 2.0.0@spinach
|