Permalink
Browse files

Use gherkin-ruby 0.3

This release aims to make transitioning from cucumber to spinach
easier, since will avoid naming conflicts with `Gherkin` -
`gherkin-ruby` 0.3 does use a different module name.
  • Loading branch information...
1 parent fb2a801 commit 6776a400b3ea0ff1659728fdac0ca2c0d458fd8c @josepjaume josepjaume committed Apr 19, 2013
View
2 Rakefile
@@ -11,7 +11,7 @@ end
desc 'Run spinach features'
task :spinach do
- exec "bundle exec spinach"
+ exec "bin/spinach"
end
task :default => [:test, :spinach]
View
2 lib/spinach.rb
@@ -18,7 +18,7 @@
require_relative 'spinach/scenario'
require_relative 'spinach/step'
-# Spinach is a BDD framework leveraging the great Gherkin language. This
+# Spinach is a BDD framework leveraging the great GherkinRuby language. This
# language is the one used defining features in Cucumber, the BDD framework
# Spinach is inspired upon.
#
View
6 lib/spinach/parser.rb
@@ -1,8 +1,8 @@
-require 'gherkin'
+require 'gherkin_ruby'
require_relative 'parser/visitor'
module Spinach
- # Parser leverages Gherkin to parse the feature definition.
+ # Parser leverages GherkinRuby to parse the feature definition.
#
class Parser
# @param [String] content
@@ -36,7 +36,7 @@ def self.open_file(filename)
#
# @api public
def parse
- ast = Gherkin.parse(@content + "\n")
+ ast = GherkinRuby.parse(@content + "\n")
Visitor.new.visit(ast)
end
end
View
16 lib/spinach/parser/visitor.rb
@@ -1,11 +1,11 @@
module Spinach
class Parser
- # The Spinach Visitor traverses the output AST from the Gherkin parser and
+ # The Spinach Visitor traverses the output AST from the GherkinRuby parser and
# populates its Feature with all the scenarios, tags, steps, etc.
#
# @example
#
- # ast = Gherkin.parse(File.read('some.feature')
+ # ast = GherkinRuby.parse(File.read('some.feature')
# visitor = Spinach::Parser::Visitor.new
# feature = visitor.visit(ast)
#
@@ -20,7 +20,7 @@ def initialize
@feature = Feature.new
end
- # @param [Gherkin::AST::Feature] ast
+ # @param [GherkinRuby::AST::Feature] ast
# The AST root node to visit.
#
# @api public
@@ -31,7 +31,7 @@ def visit(ast)
# Sets the feature name and iterates over the feature scenarios.
#
- # @param [Gherkin::AST::Feature] feature
+ # @param [GherkinRuby::AST::Feature] feature
# The feature to visit.
#
# @api public
@@ -48,7 +48,7 @@ def visit_Feature(node)
# Iterates over the steps.
#
- # @param [Gherkin::AST::Scenario] node
+ # @param [GherkinRuby::AST::Scenario] node
# The scenario to visit.
#
# @api public
@@ -65,7 +65,7 @@ def visit_Background(node)
# Sets the scenario name and iterates over the steps.
#
- # @param [Gherkin::AST::Scenario] node
+ # @param [GherkinRuby::AST::Scenario] node
# The scenario to visit.
#
# @api public
@@ -87,7 +87,7 @@ def visit_Scenario(node)
# Adds the tag to the current scenario.
#
- # @param [Gherkin::AST::Tag] node
+ # @param [GherkinRuby::AST::Tag] node
# The tag to add.
#
# @api public
@@ -97,7 +97,7 @@ def visit_Tag(node)
# Adds the step to the current scenario.
#
- # @param [Gherkin::AST::Step] step
+ # @param [GherkinRuby::AST::Step] step
# The step to add.
#
# @api public
View
10 lib/spinach/reporter/progress.rb
@@ -37,7 +37,7 @@ def on_successful_step(step, step_location, step_definitions = nil)
# Adds a failing step to the output buffer.
#
# @param [Hash] step
- # The step in a JSON Gherkin format
+ # The step in a JSON GherkinRuby format
#
# @param [Exception] failure
# The exception that caused the failure
@@ -51,7 +51,7 @@ def on_failed_step(step, failure, step_location, step_definitions = nil)
# Adds a step that has raised an error to the output buffer.
#
# @param [Hash] step
- # The step in a JSON Gherkin format
+ # The step in a JSON GherkinRuby format
#
# @param [Exception] failure
# The exception that caused the failure
@@ -65,7 +65,7 @@ def on_error_step(step, failure, step_location, step_definitions = nil)
# Adds an undefined step to the output buffer.
#
# @param [Hash] step
- # The step in a JSON Gherkin format
+ # The step in a JSON GherkinRuby format
#
def on_undefined_step(step, failure, step_definitions = nil)
output_step('U', :yellow)
@@ -76,7 +76,7 @@ def on_undefined_step(step, failure, step_definitions = nil)
# Adds an undefined step to the output buffer.
#
# @param [Hash] step
- # The step in a JSON Gherkin format
+ # The step in a JSON GherkinRuby format
#
def on_pending_step(step, failure)
output_step('P', :yellow)
@@ -87,7 +87,7 @@ def on_pending_step(step, failure)
# Adds a step that has been skipped to the output buffer.
#
# @param [Hash] step
- # The step that Gherkin extracts
+ # The step that GherkinRuby extracts
#
def on_skipped_step(step, step_definitions = nil)
output_step('~', :cyan)
View
18 lib/spinach/reporter/stdout.rb
@@ -24,7 +24,7 @@ def initialize(*args)
# Prints the feature name to the standard output
#
# @param [Hash] data
- # The feature in a JSON Gherkin format
+ # The feature in a JSON GherkinRubyRuby format
#
def before_feature_run(feature)
name = feature.name
@@ -34,7 +34,7 @@ def before_feature_run(feature)
# Prints the scenario name to the standard ouput
#
# @param [Hash] data
- # The feature in a JSON Gherkin format
+ # The feature in a JSON GherkinRubyRuby format
#
def before_scenario_run(scenario, step_definitions = nil)
@max_step_name_length = scenario.steps.map(&:name).map(&:length).max if scenario.steps.any?
@@ -45,7 +45,7 @@ def before_scenario_run(scenario, step_definitions = nil)
# Adds an error report and re
#
# @param [Hash] data
- # The feature in a JSON Gherkin format
+ # The feature in a JSON GherkinRubyRuby format
#
def after_scenario_run(scenario, step_definitions = nil)
if scenario_error
@@ -71,7 +71,7 @@ def on_successful_step(step, step_location, step_definitions = nil)
# Adds a failing step to the output buffer.
#
# @param [Hash] step
- # The step in a JSON Gherkin format
+ # The step in a JSON GherkinRubyRuby format
#
# @param [Exception] failure
# The exception that caused the failure
@@ -85,7 +85,7 @@ def on_failed_step(step, failure, step_location, step_definitions = nil)
# Adds a step that has raised an error to the output buffer.
#
# @param [Hash] step
- # The step in a JSON Gherkin format
+ # The step in a JSON GherkinRubyRuby format
#
# @param [Exception] failure
# The exception that caused the failure
@@ -99,7 +99,7 @@ def on_error_step(step, failure, step_location, step_definitions = nil)
# Adds an undefined step to the output buffer.
#
# @param [Hash] step
- # The step in a JSON Gherkin format
+ # The step in a JSON GherkinRubyRuby format
#
def on_undefined_step(step, failure, step_definitions = nil)
output_step('?', step, :yellow)
@@ -110,7 +110,7 @@ def on_undefined_step(step, failure, step_definitions = nil)
# Adds an undefined step to the output buffer.
#
# @param [Hash] step
- # The step in a JSON Gherkin format
+ # The step in a JSON GherkinRubyRuby format
#
def on_pending_step(step, failure)
output_step('P', step, :yellow)
@@ -144,7 +144,7 @@ def on_feature_not_found(feature)
# Adds a step that has been skipped to the output buffer.
#
# @param [Hash] step
- # The step that Gherkin extracts
+ # The step that GherkinRubyRuby extracts
#
def on_skipped_step(step, step_definitions = nil)
output_step('~', step, :cyan)
@@ -157,7 +157,7 @@ def on_skipped_step(step, step_definitions = nil)
# indicate if everything went ok or not).
#
# @param [Hash] step
- # The step in a JSON Gherkin format
+ # The step in a JSON GherkinRubyRuby format
#
# @param [Symbol] color
# The color code to use with Colorize to colorize the output.
View
4 lib/spinach/runner/feature_runner.rb
@@ -7,7 +7,7 @@ class Runner
class FeatureRunner
attr_reader :feature
- # @param [Gherkin::AST::Feature] feature
+ # @param [GherkinRuby::AST::Feature] feature
# The feature to run.
#
# @param [#to_i] line
@@ -28,7 +28,7 @@ def feature_name
@feature.name
end
- # @return [Array<Gherkin::AST::Scenario>]
+ # @return [Array<GherkinRuby::AST::Scenario>]
# The parsed scenarios for this runner's feature.
#
# @api public
View
8 lib/spinach/runner/scenario_runner.rb
@@ -3,23 +3,23 @@ class Runner
# A Scenario Runner handles a particular scenario run.
#
class ScenarioRunner
- # @param [Gherkin::AST::Scenario] scenario
+ # @param [GherkinRuby::AST::Scenario] scenario
# The scenario.
#
# @api public
def initialize(scenario)
@scenario = scenario
end
- # @return [Gherkin::AST::Feature>]
+ # @return [GherkinRuby::AST::Feature>]
# The feature containing the scenario.
#
# @api public
def feature
@scenario.feature
end
- # @return [Array<Gherkin::AST::Step>]
+ # @return [Array<GherkinRuby::AST::Step>]
# An array of steps.
#
# @api public
@@ -68,7 +68,7 @@ def run
# Runs a particular step.
#
- # @param [Gherkin::AST::Step] step
+ # @param [GherkinRuby::AST::Step] step
# The step to be run.
#
# @api semipublic
View
2 spinach.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
gem.summary = %q{Spinach is a BDD framework on top of gherkin}
gem.homepage = "http://github.com/codegram/spinach"
- gem.add_runtime_dependency 'gherkin-ruby', '~> 0.2.1'
+ gem.add_runtime_dependency 'gherkin-ruby', '~> 0.3.0'
gem.add_runtime_dependency 'colorize', '0.5.8'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'mocha'
View
2 test/spinach/parser_test.rb
@@ -17,7 +17,7 @@
describe '#parse' do
it 'parses the file' do
- Gherkin.expects(:parse).returns ast = stub
+ GherkinRuby.expects(:parse).returns ast = stub
Spinach::Parser::Visitor.stubs(:new).returns visitor = stub
visitor.expects(:visit).with ast
@parser.parse

0 comments on commit 6776a40

Please sign in to comment.