rspec's new expect {} syntax replaces this nicely.

This commit is contained in:
Micah Geisel 2018-04-26 11:03:58 -07:00
parent f7f8ef2cd3
commit 4205280099
4 changed files with 10 additions and 11 deletions

View file

@ -66,13 +66,13 @@ module DatabaseCleaner
end
it "should raise an error when :only and :except options are used" do
expect(running {
expect {
Truncation.new(:except => ['widgets'], :only => ['widgets'])
}).to raise_error(ArgumentError)
}.to raise_error(ArgumentError)
end
it "should raise an error when invalid options are provided" do
expect(running { Truncation.new(:foo => 'bar') }).to raise_error(ArgumentError)
expect { Truncation.new(:foo => 'bar') }.to raise_error(ArgumentError)
end
it "should not truncate views" do

View file

@ -74,7 +74,7 @@ module DatabaseCleaner
let(:cleaner) { DatabaseCleaner::Base.new :autodetect }
it "should raise an error when no ORM is detected" do
expect(running { cleaner }).to raise_error(DatabaseCleaner::NoORMDetected)
expect { cleaner }.to raise_error(DatabaseCleaner::NoORMDetected)
end
it "should detect ActiveRecord first" do

View file

@ -18,21 +18,21 @@ module DatabaseCleaner
end
it "should raise an error when the :only option is used" do
expect(running {
expect {
Truncation.new(:only => ['document-type'])
}).to raise_error(ArgumentError)
}.to raise_error(ArgumentError)
end
it "should raise an error when the :except option is used" do
expect(running {
expect {
Truncation.new(:except => ['document-type'])
}).to raise_error(ArgumentError)
}.to raise_error(ArgumentError)
end
it "should raise an error when invalid options are provided" do
expect(running {
expect {
Truncation.new(:foo => 'bar')
}).to raise_error(ArgumentError)
}.to raise_error(ArgumentError)
end
end

View file

@ -10,4 +10,3 @@ RSpec.configure do |config|
config.run_all_when_everything_filtered = true
end
alias running lambda