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 end
it "should raise an error when :only and :except options are used" do it "should raise an error when :only and :except options are used" do
expect(running { expect {
Truncation.new(:except => ['widgets'], :only => ['widgets']) Truncation.new(:except => ['widgets'], :only => ['widgets'])
}).to raise_error(ArgumentError) }.to raise_error(ArgumentError)
end end
it "should raise an error when invalid options are provided" do 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 end
it "should not truncate views" do it "should not truncate views" do

View file

@ -74,7 +74,7 @@ module DatabaseCleaner
let(:cleaner) { DatabaseCleaner::Base.new :autodetect } let(:cleaner) { DatabaseCleaner::Base.new :autodetect }
it "should raise an error when no ORM is detected" do 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 end
it "should detect ActiveRecord first" do it "should detect ActiveRecord first" do

View file

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

View file

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