Update to rspec 3

This commit is contained in:
Thomas Reynolds 2014-06-11 13:39:40 -07:00
parent d035b449ea
commit 449d38bcd2
5 changed files with 18 additions and 18 deletions

View file

@ -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

View file

@ -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'

View file

@ -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

View file

@ -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

View file

@ -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