DEV: Don’t use change { … }.by(0) in specs

This commit is contained in:
Loïc Guitaut
2022-07-19 16:03:03 +02:00
committed by Loïc Guitaut
parent 3bfc254c4e
commit 91b6b5eee7
44 changed files with 138 additions and 136 deletions

View File

@ -806,7 +806,7 @@ describe Topic do
expect { topic.invite(user, user1.username) }
.to change { Notification.count }.by(1)
.and change { Post.where(post_type: Post.types[:small_action]).count }.by(0)
.and not_change { Post.where(post_type: Post.types[:small_action]).count }
end
context "from a muted user" do
@ -1787,7 +1787,7 @@ describe Topic do
expect do
topic.change_category_to_id(new_category.id)
end.to change { Notification.count }.by(0)
end.not_to change { Notification.count }
expect(topic.category_id).to eq(new_category.id)
end
@ -1823,7 +1823,7 @@ describe Topic do
expect do
topic.change_category_to_id(new_category.id)
end.to change { Notification.count }.by(0)
end.not_to change { Notification.count }
end
end
@ -1856,7 +1856,7 @@ describe Topic do
it 'should not set a topic timer' do
expect { topic.change_category_to_id(new_category.id) }
.to change { TopicTimer.with_deleted.count }.by(0)
.not_to change { TopicTimer.with_deleted.count }
expect(topic.closed).to eq(true)
expect(topic.reload.category).to eq(new_category)