diff --git a/History.md b/History.md index 8a33889093..8de273a05b 100644 --- a/History.md +++ b/History.md @@ -1,8 +1,9 @@ -## In Git +## [v1.1.5](https://github.com/cucumber/cucumber/compare/v1.1.4...v1.1.5) ### New Features * Added `file_colon_line` to `stepdefs.json` (outputted by `--dotcucumber`). ([#214](https://github.com/cucumber/cucumber/pull/214) MOROHASHI Kyosuke) +* Upgraded to gherkin 2.3.8 (Aslak Hellesøy) ### Bugfixes diff --git a/cucumber.gemspec b/cucumber.gemspec index dae2157a1c..fa69ba26c9 100644 --- a/cucumber.gemspec +++ b/cucumber.gemspec @@ -23,7 +23,7 @@ for important information about this release. Happy cuking! } - s.add_runtime_dependency 'gherkin', '~> 2.7.3' + s.add_runtime_dependency 'gherkin', '~> 2.8.0' s.add_runtime_dependency 'term-ansicolor', '>= 1.0.6' s.add_runtime_dependency 'builder', '>= 2.1.2' s.add_runtime_dependency 'diff-lcs', '>= 1.1.2' @@ -31,7 +31,7 @@ for important information about this release. Happy cuking! s.add_development_dependency 'aruba', '~> 0.4.11' s.add_development_dependency 'rake', '>= 0.9.2' - s.add_development_dependency 'rspec', '>= 2.8.0' + s.add_development_dependency 'rspec', '~> 2.7.0' # We'll bump when gherkin is ready to bump s.add_development_dependency 'nokogiri', '>= 1.5.0' s.add_development_dependency 'prawn', '~> 0.8.4' s.add_development_dependency 'prawn-layout', '~> 0.8.4' diff --git a/lib/cucumber/ast/background.rb b/lib/cucumber/ast/background.rb index b4c4518703..c878a61644 100644 --- a/lib/cucumber/ast/background.rb +++ b/lib/cucumber/ast/background.rb @@ -99,7 +99,7 @@ def fail!(exception) # Override this method, as there are situations where the background # wind up being the one called fore Before scenarios, and # backgrounds don't have tags. - def source_tag_names + def source_tags [] end diff --git a/lib/cucumber/ast/feature.rb b/lib/cucumber/ast/feature.rb index 385be7383f..4e3909714e 100644 --- a/lib/cucumber/ast/feature.rb +++ b/lib/cucumber/ast/feature.rb @@ -53,8 +53,8 @@ def indented_name end.join("\n") end - def source_tag_names - @tags.tag_names + def source_tags + @tags.tags end def accept_hook?(hook) diff --git a/lib/cucumber/ast/feature_element.rb b/lib/cucumber/ast/feature_element.rb index de69711df9..f3ff91775f 100644 --- a/lib/cucumber/ast/feature_element.rb +++ b/lib/cucumber/ast/feature_element.rb @@ -63,11 +63,11 @@ def max_line_length end def accept_hook?(hook) - Gherkin::TagExpression.new(hook.tag_expressions).eval(source_tag_names) + Gherkin::TagExpression.new(hook.tag_expressions).eval(source_tags) end - def source_tag_names - (@tags.tag_names.to_a + (@feature ? @feature.source_tag_names.to_a : [])).uniq + def source_tags + (@tags.tags.to_a + (@feature ? @feature.source_tags.to_a : [])).uniq end def language diff --git a/lib/cucumber/ast/outline_table.rb b/lib/cucumber/ast/outline_table.rb index abbae2c4bc..5c7e6aa3f2 100644 --- a/lib/cucumber/ast/outline_table.rb +++ b/lib/cucumber/ast/outline_table.rb @@ -34,8 +34,8 @@ def accept_hook?(hook) @scenario_outline.accept_hook?(hook) end - def source_tag_names - @scenario_outline.source_tag_names + def source_tags + @scenario_outline.source_tags end def skip_invoke! @@ -79,8 +79,8 @@ def initialize(table, cells) @scenario_exception = nil end - def source_tag_names - @table.source_tag_names + def source_tags + @table.source_tags end def create_step_invocations!(scenario_outline) diff --git a/lib/cucumber/ast/tags.rb b/lib/cucumber/ast/tags.rb index 23bd5911b8..7d522906a4 100644 --- a/lib/cucumber/ast/tags.rb +++ b/lib/cucumber/ast/tags.rb @@ -3,25 +3,25 @@ module Cucumber module Ast class Tags #:nodoc: - attr_reader :tag_names + attr_reader :tags - def initialize(line, tag_names) - @line, @tag_names = line, tag_names + def initialize(line, tags) + @line, @tags = line, tags end def accept(visitor) return if Cucumber.wants_to_quit - @tag_names.each do |tag_name| - visitor.visit_tag_name(tag_name) + @tags.each do |tag| + visitor.visit_tag_name(tag.name) end end def accept_hook?(hook) - Gherkin::TagExpression.new(hook.tag_expressions).eval(@tag_names) + Gherkin::TagExpression.new(hook.tag_expressions).eval(@tags) end def to_sexp - @tag_names.map{|tag_name| [:tag, tag_name]} + @tags.map{|tag| [:tag, tag.name]} end end end diff --git a/lib/cucumber/parser/gherkin_builder.rb b/lib/cucumber/parser/gherkin_builder.rb index d3df4e73c8..ff24fa90e9 100644 --- a/lib/cucumber/parser/gherkin_builder.rb +++ b/lib/cucumber/parser/gherkin_builder.rb @@ -18,7 +18,7 @@ def feature(feature) @feature = Ast::Feature.new( nil, Ast::Comment.new(feature.comments.map{|comment| comment.value}.join("\n")), - Ast::Tags.new(nil, feature.tags.map{|tag| tag.name}), + Ast::Tags.new(nil, feature.tags), feature.keyword, feature.name.lstrip, feature.description.rstrip, @@ -47,7 +47,7 @@ def scenario(statement) scenario = Ast::Scenario.new( @background, Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")), - Ast::Tags.new(nil, statement.tags.map{|tag| tag.name}), + Ast::Tags.new(nil, statement.tags), statement.line, statement.keyword, statement.name, @@ -64,7 +64,7 @@ def scenario_outline(statement) scenario_outline = Ast::ScenarioOutline.new( @background, Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")), - Ast::Tags.new(nil, statement.tags.map{|tag| tag.name}), + Ast::Tags.new(nil, statement.tags), statement.line, statement.keyword, statement.name, diff --git a/lib/cucumber/platform.rb b/lib/cucumber/platform.rb index d0b5aa51d6..21fe5469a5 100644 --- a/lib/cucumber/platform.rb +++ b/lib/cucumber/platform.rb @@ -4,7 +4,7 @@ module Cucumber unless defined?(Cucumber::VERSION) - VERSION = '1.1.4' + VERSION = '1.1.5' BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber') LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib') JRUBY = defined?(JRUBY_VERSION) diff --git a/lib/cucumber/wire_support/wire_protocol/requests.rb b/lib/cucumber/wire_support/wire_protocol/requests.rb index e8a54155df..e7fd2b312d 100644 --- a/lib/cucumber/wire_support/wire_protocol/requests.rb +++ b/lib/cucumber/wire_support/wire_protocol/requests.rb @@ -94,13 +94,13 @@ class DiffOk < RequestHandler end module Tags - def clean_tags(scenario) - scenario.source_tag_names.map { |tag| tag.gsub(/^@/, '') }.sort + def clean_tag_names(scenario) + scenario.source_tags.map { |tag| tag.name.gsub(/^@/, '') }.sort end def request_params(scenario) - return nil unless scenario.source_tag_names.any? - { "tags" => clean_tags(scenario) } + return nil unless scenario.source_tags.any? + { "tags" => clean_tag_names(scenario) } end end diff --git a/spec/cucumber/ast/feature_factory.rb b/spec/cucumber/ast/feature_factory.rb index e41a180db8..2f798eef7b 100644 --- a/spec/cucumber/ast/feature_factory.rb +++ b/spec/cucumber/ast/feature_factory.rb @@ -1,5 +1,6 @@ require 'cucumber/ast' require 'cucumber/step_mother' +require 'gherkin/formatter/model' module Cucumber module Ast @@ -35,14 +36,14 @@ def create_feature(dsl) f = Ast::Feature.new( background, Ast::Comment.new("# My feature comment\n"), - Ast::Tags.new(6, ['one', 'two']), + Ast::Tags.new(6, [Gherkin::Formatter::Model::Tag.new('one', 6), Gherkin::Formatter::Model::Tag.new('two', 6)]), "Feature", "Pretty printing", "", [Ast::Scenario.new( background, Ast::Comment.new(" # My scenario comment \n# On two lines \n"), - Ast::Tags.new(8, ['three', 'four']), + Ast::Tags.new(8, [Gherkin::Formatter::Model::Tag.new('three', 8), Gherkin::Formatter::Model::Tag.new('four', 8)]), 9, "Scenario:", "A Scenario", "", [