From 53e3d5f9623b67277f691bfa39229468de5ed670 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Fri, 28 Jul 2017 10:38:36 +0100 Subject: [PATCH] [functional tests] upgrade to Ruby 2.4.1 --- .ruby-version | 2 +- Gemfile | 4 +- Gemfile.lock | 60 +++++++++++++++--------- features/step_definitions/cache_steps.rb | 17 +++---- features/step_definitions/thin_steps.rb | 6 +-- 5 files changed, 53 insertions(+), 36 deletions(-) diff --git a/.ruby-version b/.ruby-version index 77fee73..005119b 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -1.9.3 +2.4.1 diff --git a/Gemfile b/Gemfile index ed7c51a..fb45034 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' group :test do - gem 'cucumber' + gem 'cucumber', '~> 2.4.0' gem 'aruba' - gem 'thinp_xml' + gem 'thinp_xml', :path => "/home/ejt/work/RedHat/thinp_xml" end diff --git a/Gemfile.lock b/Gemfile.lock index d198286..08e49eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,37 +1,53 @@ +PATH + remote: /home/ejt/work/RedHat/thinp_xml + specs: + thinp_xml (0.0.22) + ejt_command_line (>= 0.0.2) + GEM remote: https://rubygems.org/ specs: - aruba (0.6.1) - childprocess (>= 0.3.6) - cucumber (>= 1.1.1) - rspec-expectations (>= 2.7.0) - builder (3.2.2) - childprocess (0.5.3) + aruba (0.14.2) + childprocess (~> 0.5.6) + contracts (~> 0.9) + cucumber (>= 1.3.19) + ffi (~> 1.9.10) + rspec-expectations (>= 2.99) + thor (~> 0.19) + builder (3.2.3) + childprocess (0.5.9) ffi (~> 1.0, >= 1.0.11) - cucumber (1.3.16) + contracts (0.16.0) + cucumber (2.4.0) builder (>= 2.1.2) + cucumber-core (~> 1.5.0) + cucumber-wire (~> 0.0.1) diff-lcs (>= 1.1.3) - gherkin (~> 2.12) + gherkin (~> 4.0) multi_json (>= 1.7.5, < 2.0) - multi_test (>= 0.1.1) - diff-lcs (1.2.5) + multi_test (>= 0.1.2) + cucumber-core (1.5.0) + gherkin (~> 4.0) + cucumber-wire (0.0.1) + diff-lcs (1.3) ejt_command_line (0.0.4) - ffi (1.9.3) - gherkin (2.12.2) - multi_json (~> 1.3) - multi_json (1.10.1) - multi_test (0.1.1) - rspec-expectations (3.0.4) + ffi (1.9.18) + gherkin (4.1.3) + multi_json (1.12.1) + multi_test (0.1.2) + rspec-expectations (3.6.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.0.0) - rspec-support (3.0.4) - thinp_xml (0.0.20) - ejt_command_line (>= 0.0.2) + rspec-support (~> 3.6.0) + rspec-support (3.6.0) + thor (0.19.4) PLATFORMS ruby DEPENDENCIES aruba - cucumber - thinp_xml + cucumber (~> 2.4.0) + thinp_xml! + +BUNDLED WITH + 1.15.3 diff --git a/features/step_definitions/cache_steps.rb b/features/step_definitions/cache_steps.rb index 7949cd0..c9d3841 100644 --- a/features/step_definitions/cache_steps.rb +++ b/features/step_definitions/cache_steps.rb @@ -7,7 +7,7 @@ end Given /^input without read permissions$/ do write_file(DEFAULT_INPUT, "\0" * 4096) - in_current_dir do + cd(".") do f = File.new(DEFAULT_INPUT) f.chmod(0000) end @@ -18,7 +18,7 @@ Given(/^input file$/) do end Given(/^block (\d+) is zeroed$/) do |b| - in_current_dir do + cd(".") do File.open(DEFAULT_INPUT, 'w') do |f| f.seek(BLOCK_SIZE * b.to_i, IO::SEEK_SET) f.write("\0" * BLOCK_SIZE) @@ -27,11 +27,11 @@ Given(/^block (\d+) is zeroed$/) do |b| end Then /^it should pass$/ do - assert_success(true) + expect(last_command_started).to be_successfully_executed end Then /^it should fail$/ do - assert_success(false) + expect(last_command_started).to_not be_successfully_executed end CACHE_USAGE =< #{xml_file}") system("dd if=/dev/zero of=#{dev_file} bs=4k count=1024 > /dev/null") end @@ -92,7 +93,7 @@ Then(/^cache dumps (\d+) and (\d+) should be identical$/) do |d1, d2| end Given(/^a small xml file$/) do - in_current_dir do + cd(".") do system("cache_xml create --nr-cache-blocks 3 --nr-mappings 3 --layout linear --dirty-percent 100 > #{xml_file}") end end diff --git a/features/step_definitions/thin_steps.rb b/features/step_definitions/thin_steps.rb index 39527f4..5f62a68 100644 --- a/features/step_definitions/thin_steps.rb +++ b/features/step_definitions/thin_steps.rb @@ -42,13 +42,13 @@ When(/^I run thin_restore with (.*?)$/) do |opts| end Then /^it should give no output$/ do - ps = only_processes.last + ps = all_commands.last output = ps.stdout + ps.stderr - output.should == "" + expect(output).to eq("") end Then(/^it should pass with version$/) do - only_processes.last.stdout.chomp.should == tools_version + expect(all_commands.last.stdout.chomp).to eq(tools_version) end When(/^I dump$/) do