mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 20:45:35 +08:00
DEV: Don’t use change { … }.by(0)
in specs
This commit is contained in:

committed by
Loïc Guitaut

parent
3bfc254c4e
commit
91b6b5eee7
@ -84,7 +84,7 @@ describe Admin::SiteSettingsController do
|
||||
put "/admin/site_settings/default_email_in_reply_to.json", params: {
|
||||
default_email_in_reply_to: false
|
||||
}
|
||||
}.to change { UserOption.where(email_in_reply_to: false).count }.by(0)
|
||||
}.not_to change { UserOption.where(email_in_reply_to: false).count }
|
||||
end
|
||||
|
||||
it 'should update `email_digests` column in existing user options' do
|
||||
@ -153,7 +153,7 @@ describe Admin::SiteSettingsController do
|
||||
put "/admin/site_settings/default_categories_watching.json", params: {
|
||||
default_categories_watching: category_ids.last(2).join("|")
|
||||
}
|
||||
}.to change { CategoryUser.where(category_id: category_ids.first, notification_level: watching).count }.by(0)
|
||||
}.not_to change { CategoryUser.where(category_id: category_ids.first, notification_level: watching).count }
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(CategoryUser.where(category_id: category_ids.last, notification_level: watching).count).to eq(0)
|
||||
@ -204,7 +204,7 @@ describe Admin::SiteSettingsController do
|
||||
put "/admin/site_settings/default_tags_watching.json", params: {
|
||||
default_tags_watching: tags.last(2).pluck(:name).join("|")
|
||||
}
|
||||
}.to change { TagUser.where(tag_id: tags.first.id, notification_level: watching).count }.by(0)
|
||||
}.not_to change { TagUser.where(tag_id: tags.first.id, notification_level: watching).count }
|
||||
|
||||
expect(TagUser.where(tag_id: tags.last.id, notification_level: watching).count).to eq(0)
|
||||
end
|
||||
|
@ -154,7 +154,7 @@ RSpec.describe Admin::UsersController do
|
||||
suspend_until: 5.hours.from_now,
|
||||
reason: "because I said so"
|
||||
}
|
||||
end.to change { Jobs::CriticalUserEmail.jobs.size }.by(0)
|
||||
end.not_to change { Jobs::CriticalUserEmail.jobs.size }
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
|
Reference in New Issue
Block a user