From fc8c0cfc4f431b5747a6a694c3d47da60385b051 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Thu, 7 Apr 2016 15:08:45 -0700 Subject: [PATCH] Use latest gherkin (faster install) --- .gitignore | 1 + Gemfile | 2 +- features/support/env.rb | 1 - foodcritic.gemspec | 2 +- lib/foodcritic.rb | 2 +- lib/foodcritic/domain.rb | 8 ++++---- spec/foodcritic/api_spec.rb | 6 +++--- spec/spec_helper.rb | 1 - 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index c1589bfa..75c6bbe7 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ Gemfile.lock .rvmrc /.bundle/ /tags +binstubs/ diff --git a/Gemfile b/Gemfile index 414ffffe..604a4426 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ gem 'foodcritic', :path => '.' group :test do gem 'aruba', '~> 0.5' - gem 'cucumber', '~> 1.3' + gem 'cucumber', '>= 2' gem 'minitest', '~> 5.3' gem 'simplecov', '~> 0.8' end diff --git a/features/support/env.rb b/features/support/env.rb index eba6f804..b1143664 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -10,7 +10,6 @@ require 'aruba/cucumber' require 'foodcritic' -require 'minitest/autorun' require 'minitest/spec' MiniTest::Spec.new(nil) diff --git a/foodcritic.gemspec b/foodcritic.gemspec index 48d2626f..8bed0ff1 100644 --- a/foodcritic.gemspec +++ b/foodcritic.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.license = 'MIT' s.executables << 'foodcritic' s.required_ruby_version = ">= 2.0.0" - s.add_dependency('gherkin', '~> 2.11') + s.add_dependency('cucumber-core', '>= 1.3') s.add_dependency('nokogiri', '>= 1.5', '< 2.0') s.add_dependency('rake') s.add_dependency('treetop', '~> 1.4') diff --git a/lib/foodcritic.rb b/lib/foodcritic.rb index 880eb882..75db4b7c 100644 --- a/lib/foodcritic.rb +++ b/lib/foodcritic.rb @@ -1,5 +1,5 @@ require 'pathname' -require 'gherkin' +require 'cucumber/core' require 'treetop' require 'ripper' require 'yajl' diff --git a/lib/foodcritic/domain.rb b/lib/foodcritic/domain.rb index 1e8ad97f..baa0aa30 100644 --- a/lib/foodcritic/domain.rb +++ b/lib/foodcritic/domain.rb @@ -1,4 +1,4 @@ -require 'gherkin/tag_expression' +require 'cucumber/core/gherkin/tag_expression' module FoodCritic # A warning of a possible issue @@ -95,9 +95,9 @@ def tags # Checks the rule tags to see if they match a Gherkin (Cucumber) expression def matches_tags?(tag_expr) - Gherkin::TagExpression.new(tag_expr).evaluate(tags.map do |t| - Gherkin::Formatter::Model::Tag.new(t, 1) - end) + Cucumber::Core::Gherkin::TagExpression.new(tag_expr).evaluate( + tags.map { |tag| Cucumber::Core::Ast::Tag.new(nil, tag) } + ) end # Returns a string representation of this rule. diff --git a/spec/foodcritic/api_spec.rb b/spec/foodcritic/api_spec.rb index 71b4c3aa..a392ec02 100644 --- a/spec/foodcritic/api_spec.rb +++ b/spec/foodcritic/api_spec.rb @@ -138,7 +138,7 @@ def parse_ast(str) end describe "#checks_for_chef_solo?" do - let(:ast) { ast = MiniTest::Mock.new } + let(:ast) { MiniTest::Mock.new } it "raises if the provided ast does not support XPath" do lambda{api.checks_for_chef_solo?(nil)}.must_raise(ArgumentError) end @@ -459,7 +459,7 @@ def parse_ast(str) end describe "#literal_searches" do - let(:ast) { ast = MiniTest::Mock.new } + let(:ast) { MiniTest::Mock.new } it "returns empty if the AST does not support XPath expressions" do api.literal_searches(nil).must_be_empty end @@ -1642,7 +1642,7 @@ def str_to_atts(str) end describe "#searches" do - let(:ast) { ast = MiniTest::Mock.new } + let(:ast) { MiniTest::Mock.new } it "returns empty if the AST does not support XPath expressions" do api.searches('not-an-ast').must_be_empty end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1afd8a39..7afbaed9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,6 @@ warn 'warning: simplecov gem not found; skipping coverage' end -require 'minitest/autorun' require 'minitest/pride' require 'minitest/spec'