From 1ed2c16a51bcadbfc69e03df22be984b2f11ade7 Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Thu, 30 Apr 2015 14:54:14 +0200 Subject: [PATCH] upgrade to cucumber 2.0 --- Gemfile.lock | 27 ++++++++++++-------- features/step_definitions/distance_matrix.rb | 2 +- features/step_definitions/locate.rb | 2 +- features/step_definitions/nearest.rb | 2 +- features/step_definitions/routability.rb | 2 +- features/step_definitions/routing.rb | 2 +- features/support/cucumber.rb | 4 +-- features/support/hooks.rb | 16 ++++-------- 8 files changed, 28 insertions(+), 29 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ac056a0a2..3363e9218 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,22 +2,27 @@ GEM remote: http://rubygems.org/ specs: builder (3.2.2) - cucumber (1.3.8) + cucumber (2.0.0) builder (>= 2.1.2) + cucumber-core (~> 1.1.3) diff-lcs (>= 1.1.3) - gherkin (~> 2.12.1) + gherkin (~> 2.12) multi_json (>= 1.7.5, < 2.0) - multi_test (>= 0.0.2) - diff-lcs (1.2.4) - gherkin (2.12.1) + multi_test (>= 0.1.2) + cucumber-core (1.1.3) + gherkin (~> 2.12.0) + diff-lcs (1.2.5) + gherkin (2.12.2) multi_json (~> 1.3) - multi_json (1.8.0) - multi_test (0.0.2) + multi_json (1.11.0) + multi_test (0.1.2) osmlib-base (0.1.4) - rake (10.1.0) - rspec-expectations (2.14.3) - diff-lcs (>= 1.1.3, < 2.0) - sys-proctable (0.9.3) + rake (10.4.2) + rspec-expectations (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.2) + sys-proctable (0.9.8) PLATFORMS ruby diff --git a/features/step_definitions/distance_matrix.rb b/features/step_definitions/distance_matrix.rb index f85bdcc07..8c4e927de 100644 --- a/features/step_definitions/distance_matrix.rb +++ b/features/step_definitions/distance_matrix.rb @@ -52,5 +52,5 @@ When /^I request a travel time matrix I should get$/ do |table| actual << r end end - table.routing_diff! actual + table.diff! actual end diff --git a/features/step_definitions/locate.rb b/features/step_definitions/locate.rb index 3e67be3c9..190795c26 100644 --- a/features/step_definitions/locate.rb +++ b/features/step_definitions/locate.rb @@ -39,7 +39,7 @@ When /^I request locate I should get$/ do |table| actual << got end end - table.routing_diff! actual + table.diff! actual end When /^I request locate (\d+) times I should get$/ do |n,table| diff --git a/features/step_definitions/nearest.rb b/features/step_definitions/nearest.rb index 532c1f0d7..099f4e06f 100644 --- a/features/step_definitions/nearest.rb +++ b/features/step_definitions/nearest.rb @@ -39,7 +39,7 @@ When /^I request nearest I should get$/ do |table| actual << got end end - table.routing_diff! actual + table.diff! actual end When /^I request nearest (\d+) times I should get$/ do |n,table| diff --git a/features/step_definitions/routability.rb b/features/step_definitions/routability.rb index dcbde5afa..a9241bef7 100644 --- a/features/step_definitions/routability.rb +++ b/features/step_definitions/routability.rb @@ -74,5 +74,5 @@ Then /^routability should be$/ do |table| actual << output_row end end - table.routing_diff! actual + table.diff! actual end diff --git a/features/step_definitions/routing.rb b/features/step_definitions/routing.rb index c25f5b7c8..597ea65d6 100644 --- a/features/step_definitions/routing.rb +++ b/features/step_definitions/routing.rb @@ -140,7 +140,7 @@ When /^I route I should get$/ do |table| actual << got end end - table.routing_diff! actual + table.diff! actual end When /^I route (\d+) times I should get$/ do |n,table| diff --git a/features/support/cucumber.rb b/features/support/cucumber.rb index a43082a7a..09df5498d 100644 --- a/features/support/cucumber.rb +++ b/features/support/cucumber.rb @@ -1,8 +1,8 @@ #monkey patch cucumber table class to reorder output. #we always want failed rows to be shown right below the expected row. -class Cucumber::Ast::Table - def routing_diff!(other_table, options={}) +class Cucumber::MultilineArgument::DataTable + def diff!(other_table, options={}) options = {:missing_row => true, :surplus_row => true, :missing_col => true, :surplus_col => false}.merge(options) other_table = ensure_table(other_table) diff --git a/features/support/hooks.rb b/features/support/hooks.rb index 337014246..2ad49dcae 100644 --- a/features/support/hooks.rb +++ b/features/support/hooks.rb @@ -4,22 +4,16 @@ STRESS_TIMEOUT = 300 Before do |scenario| - # feature name + # fetch scenario and feature name, so we can use it in log files if needed case scenario - when Cucumber::Ast::Scenario + when Cucumber::RunningTestCase::Scenario @feature_name = scenario.feature.name - when Cucumber::Ast::OutlineTable::ExampleRow - @feature_name = scenario.scenario_outline.feature.name - end - - # scenario name - case scenario - when Cucumber::Ast::Scenario @scenario_title = scenario.name - when Cucumber::Ast::OutlineTable::ExampleRow + when Cucumber::RunningTestCase::ExampleRow + @feature_name = scenario.scenario_outline.feature.name @scenario_title = scenario.scenario_outline.name end - + @load_method = DEFAULT_LOAD_METHOD @query_params = {} @scenario_time = Time.now.strftime("%Y-%m-%dT%H:%m:%SZ")