Update to rspec 3
This commit is contained in:
parent
d035b449ea
commit
449d38bcd2
8
Gemfile
8
Gemfile
|
@ -5,10 +5,10 @@ gem 'rake', '~> 10.0.3', require: false
|
||||||
gem 'yard', '~> 0.8.0', require: false
|
gem 'yard', '~> 0.8.0', require: false
|
||||||
|
|
||||||
# Test tools
|
# Test tools
|
||||||
gem 'cucumber', '~> 1.3.1'
|
gem 'cucumber', '~> 1.3.15'
|
||||||
gem 'fivemat', '~> 1.2.1'
|
gem 'fivemat', '~> 1.3.1'
|
||||||
gem 'aruba', '~> 0.5.1'
|
gem 'aruba', '~> 0.5.4'
|
||||||
gem 'rspec', '~> 2.12'
|
gem 'rspec', '~> 3.0'
|
||||||
gem 'simplecov'
|
gem 'simplecov'
|
||||||
|
|
||||||
# Optional middleman dependencies, included for tests
|
# Optional middleman dependencies, included for tests
|
||||||
|
|
|
@ -34,7 +34,7 @@ require 'rspec/core/rake_task'
|
||||||
desc 'Run RSpec'
|
desc 'Run RSpec'
|
||||||
RSpec::Core::RakeTask.new do |spec|
|
RSpec::Core::RakeTask.new do |spec|
|
||||||
spec.pattern = 'spec/**/*_spec.rb'
|
spec.pattern = 'spec/**/*_spec.rb'
|
||||||
spec.rspec_opts = ['--color', '--format nested']
|
spec.rspec_opts = ['--color', '--format documentation']
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Run tests, both RSpec and Cucumber'
|
desc 'Run tests, both RSpec and Cucumber'
|
||||||
|
|
|
@ -64,7 +64,7 @@ end
|
||||||
|
|
||||||
Then /^the file "([^\"]*)" should not have been updated$/ do |file|
|
Then /^the file "([^\"]*)" should not have been updated$/ do |file|
|
||||||
target = File.join(current_dir, file)
|
target = File.join(current_dir, file)
|
||||||
File.mtime(target).should == @modification_times[target]
|
expect(File.mtime(target)).to eq(@modification_times[target])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Provide this Aruba overload in case we're matching something with quotes in it
|
# Provide this Aruba overload in case we're matching something with quotes in it
|
||||||
|
|
|
@ -71,40 +71,40 @@ end
|
||||||
|
|
||||||
Then /^going to "([^\"]*)" should not raise an exception$/ do |url|
|
Then /^going to "([^\"]*)" should not raise an exception$/ do |url|
|
||||||
last_response = nil
|
last_response = nil
|
||||||
lambda {
|
expect {
|
||||||
last_response = @browser.get(URI.escape(url))
|
last_response = @browser.get(URI.escape(url))
|
||||||
}.should_not raise_exception
|
}.to_not raise_error
|
||||||
@last_response = last_response
|
@last_response = last_response
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^the content type should be "([^\"]*)"$/ do |expected|
|
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
|
end
|
||||||
|
|
||||||
Then /^I should see "([^\"]*)"$/ do |expected|
|
Then /^I should see "([^\"]*)"$/ do |expected|
|
||||||
@last_response.body.should include(expected)
|
expect(@last_response.body).to include(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should see '([^\']*)'$/ do |expected|
|
Then /^I should see '([^\']*)'$/ do |expected|
|
||||||
@last_response.body.should include(expected)
|
expect(@last_response.body).to include(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should see:$/ do |expected|
|
Then /^I should see:$/ do |expected|
|
||||||
@last_response.body.should include(expected)
|
expect(@last_response.body).to include(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should not see "([^\"]*)"$/ do |expected|
|
Then /^I should not see "([^\"]*)"$/ do |expected|
|
||||||
@last_response.body.should_not include(expected)
|
expect(@last_response.body).to_not include(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should see content matching %r{(.*)}$/ do |expected|
|
Then /^I should see content matching %r{(.*)}$/ do |expected|
|
||||||
@last_response.body.should match(expected)
|
expect(@last_response.body).to match(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should not see content matching %r{(.*)}$/ do |expected|
|
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
|
end
|
||||||
|
|
||||||
Then /^I should see "([^\"]*)" lines$/ do |lines|
|
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
|
end
|
||||||
|
|
|
@ -3,13 +3,13 @@ require 'middleman-core/util'
|
||||||
describe "Middleman::Util#binary?" do
|
describe "Middleman::Util#binary?" do
|
||||||
%w(plain.txt unicode.txt unicode).each do |file|
|
%w(plain.txt unicode.txt unicode).each do |file|
|
||||||
it "recognizes #{file} as not binary" do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(middleman.png middleman stars.svgz).each do |file|
|
%w(middleman.png middleman stars.svgz).each do |file|
|
||||||
it "recognizes #{file} as binary" do
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue