From 449d38bcd287a4fe8858cba29b1ab83904f933a1 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 11 Jun 2014 13:39:40 -0700 Subject: [PATCH] Update to rspec 3 --- Gemfile | 8 ++++---- gem_rake_helper.rb | 2 +- .../step_definitions/builder_steps.rb | 2 +- .../step_definitions/server_steps.rb | 20 +++++++++---------- .../spec/middleman-core/binary_spec.rb | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Gemfile b/Gemfile index 504273be..c1d05994 100644 --- a/Gemfile +++ b/Gemfile @@ -5,10 +5,10 @@ gem 'rake', '~> 10.0.3', require: false gem 'yard', '~> 0.8.0', require: false # Test tools -gem 'cucumber', '~> 1.3.1' -gem 'fivemat', '~> 1.2.1' -gem 'aruba', '~> 0.5.1' -gem 'rspec', '~> 2.12' +gem 'cucumber', '~> 1.3.15' +gem 'fivemat', '~> 1.3.1' +gem 'aruba', '~> 0.5.4' +gem 'rspec', '~> 3.0' gem 'simplecov' # Optional middleman dependencies, included for tests diff --git a/gem_rake_helper.rb b/gem_rake_helper.rb index 284cf5dc..7b4a8990 100644 --- a/gem_rake_helper.rb +++ b/gem_rake_helper.rb @@ -34,7 +34,7 @@ require 'rspec/core/rake_task' desc 'Run RSpec' RSpec::Core::RakeTask.new do |spec| spec.pattern = 'spec/**/*_spec.rb' - spec.rspec_opts = ['--color', '--format nested'] + spec.rspec_opts = ['--color', '--format documentation'] end desc 'Run tests, both RSpec and Cucumber' diff --git a/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb b/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb index eda6467b..d0478d6a 100644 --- a/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb @@ -64,7 +64,7 @@ end Then /^the file "([^\"]*)" should not have been updated$/ do |file| target = File.join(current_dir, file) - File.mtime(target).should == @modification_times[target] + expect(File.mtime(target)).to eq(@modification_times[target]) end # Provide this Aruba overload in case we're matching something with quotes in it diff --git a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb index 0009e67a..c72d8712 100644 --- a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb @@ -71,40 +71,40 @@ end Then /^going to "([^\"]*)" should not raise an exception$/ do |url| last_response = nil - lambda { + expect { last_response = @browser.get(URI.escape(url)) - }.should_not raise_exception + }.to_not raise_error @last_response = last_response end Then /^the content type should be "([^\"]*)"$/ do |expected| - @last_response.content_type.should start_with(expected) + expect(@last_response.content_type).to start_with(expected) end Then /^I should see "([^\"]*)"$/ do |expected| - @last_response.body.should include(expected) + expect(@last_response.body).to include(expected) end Then /^I should see '([^\']*)'$/ do |expected| - @last_response.body.should include(expected) + expect(@last_response.body).to include(expected) end Then /^I should see:$/ do |expected| - @last_response.body.should include(expected) + expect(@last_response.body).to include(expected) end Then /^I should not see "([^\"]*)"$/ do |expected| - @last_response.body.should_not include(expected) + expect(@last_response.body).to_not include(expected) end Then /^I should see content matching %r{(.*)}$/ do |expected| - @last_response.body.should match(expected) + expect(@last_response.body).to match(expected) end Then /^I should not see content matching %r{(.*)}$/ do |expected| - @last_response.body.should_not match(expected) + expect(@last_response.body).to_not match(expected) end Then /^I should see "([^\"]*)" lines$/ do |lines| - @last_response.body.chomp.split($/).length.should == lines.to_i + expect(@last_response.body.chomp.split($/).length).to eq(lines.to_i) end diff --git a/middleman-core/spec/middleman-core/binary_spec.rb b/middleman-core/spec/middleman-core/binary_spec.rb index 79944331..4f8d11d2 100644 --- a/middleman-core/spec/middleman-core/binary_spec.rb +++ b/middleman-core/spec/middleman-core/binary_spec.rb @@ -3,13 +3,13 @@ require 'middleman-core/util' describe "Middleman::Util#binary?" do %w(plain.txt unicode.txt unicode).each do |file| it "recognizes #{file} as not binary" do - expect(Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}"))).to be_false + expect(Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}"))).to be false end end %w(middleman.png middleman stars.svgz).each do |file| it "recognizes #{file} as binary" do - expect(Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}"))).to be_true + expect(Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}"))).to be true end end end