From 701cd6041cac8b7a9dc055aa16433a09624d6c5f 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 + foodcritic.gemspec | 2 +- lib/foodcritic.rb | 2 +- lib/foodcritic/domain.rb | 8 ++++---- spec/foodcritic/api_spec.rb | 6 +++--- 5 files changed, 10 insertions(+), 9 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/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