mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 04:56:06 +08:00
DEV: Fix specs deprecations (#16059)
This commit is contained in:
parent
b05fddaa7c
commit
4020738eed
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user