DEV: Fix specs deprecations (#16059)

This commit is contained in:
Jarek Radosz 2022-02-26 03:51:39 +01:00 committed by GitHub
parent b05fddaa7c
commit 4020738eed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 13 deletions

View File

@ -37,7 +37,7 @@ describe HasErrors do
it "triggers a rollback" do
invalid_topic.valid?
expect(-> { error_test.rollback_from_errors!(invalid_topic) }).to raise_error(ActiveRecord::Rollback)
expect { error_test.rollback_from_errors!(invalid_topic) }.to raise_error(ActiveRecord::Rollback)
expect(error_test.errors).to be_present
expect(error_test.errors[:base]).to include(title_error)
end
@ -46,9 +46,9 @@ describe HasErrors do
context "rollback_with_error!" do
it "triggers a rollback" do
expect(-> {
expect do
error_test.rollback_with!(invalid_topic, :too_many_users)
}).to raise_error(ActiveRecord::Rollback)
end.to raise_error(ActiveRecord::Rollback)
expect(error_test.errors).to be_present
expect(error_test.errors[:base]).to include("You can only send warnings to one user at a time.")
end

View File

@ -23,9 +23,9 @@ describe Migration::SafeMigrate do
path = File.expand_path "#{Rails.root}/spec/fixtures/db/migrate/drop_table"
output = capture_stdout do
expect(lambda do
expect do
migrate_up(path)
end).to raise_error(StandardError)
end.to raise_error(StandardError)
end
expect(output).to include("rails g post_migration")
@ -40,9 +40,9 @@ describe Migration::SafeMigrate do
path = File.expand_path "#{Rails.root}/spec/fixtures/db/migrate/rename_table"
output = capture_stdout do
expect(lambda do
expect do
migrate_up(path)
end).to raise_error(StandardError)
end.to raise_error(StandardError)
end
expect { User.first }.not_to raise_error
@ -57,9 +57,9 @@ describe Migration::SafeMigrate do
path = File.expand_path "#{Rails.root}/spec/fixtures/db/migrate/remove_column"
output = capture_stdout do
expect(lambda do
expect do
migrate_up(path)
end).to raise_error(StandardError)
end.to raise_error(StandardError)
end
expect(output).to include("rails g post_migration")
@ -74,9 +74,9 @@ describe Migration::SafeMigrate do
path = File.expand_path "#{Rails.root}/spec/fixtures/db/migrate/rename_column"
output = capture_stdout do
expect(lambda do
expect do
migrate_up(path)
end).to raise_error(StandardError)
end.to raise_error(StandardError)
end
expect(output).to include("rails g post_migration")

View File

@ -73,7 +73,7 @@ RSpec.describe ReviewableQueuedPost, type: :model do
expect(notifications).to be_present
# We can't approve twice
expect(-> { reviewable.perform(moderator, :approve_post) }).to raise_error(Reviewable::InvalidAction)
expect { reviewable.perform(moderator, :approve_post) }.to raise_error(Reviewable::InvalidAction)
end
it "skips validations" do
@ -113,7 +113,7 @@ RSpec.describe ReviewableQueuedPost, type: :model do
expect(Post.count).to eq(post_count)
# We can't reject twice
expect(-> { reviewable.perform(moderator, :reject_post) }).to raise_error(Reviewable::InvalidAction)
expect { reviewable.perform(moderator, :reject_post) }.to raise_error(Reviewable::InvalidAction)
end
end