Add and apply RSpec/BeEq rubocop rule

This rule was added in rubocop-rspec 2.9.0. Once again, we were applying
it about 50% of the time.
This commit is contained in:
Javi Martín
2023-08-29 19:14:49 +02:00
parent 6268ae9274
commit f79a21f071
31 changed files with 213 additions and 210 deletions

View File

@@ -20,14 +20,14 @@ shared_examples "notifiable" do
it "returns true when it's a root comment and the notifiable is available" do
notification = create(:notification, notifiable: notifiable)
expect(notification.notifiable_available?).to be(true)
expect(notification.notifiable_available?).to be true
end
it "returns true when it's a reply to comment and the notifiable is available" do
comment = create(:comment, commentable: notifiable)
notification = create(:notification, notifiable: comment)
expect(notification.notifiable_available?).to be(true)
expect(notification.notifiable_available?).to be true
end
it "returns false when it's a root comment and the notifiable has been hidden" do
@@ -36,7 +36,7 @@ shared_examples "notifiable" do
notifiable.hide
notification.reload
expect(notification.notifiable_available?).not_to be(true)
expect(notification.notifiable_available?).not_to be true
end
it "returns false when it's a reply to comment and the commentable has been hidden" do
@@ -46,26 +46,26 @@ shared_examples "notifiable" do
notifiable.hide
notification.reload
expect(notification.notifiable_available?).to be(false)
expect(notification.notifiable_available?).to be false
end
end
describe "check_availability" do
it "returns true if the resource is present, not hidden, nor retired" do
notification = create(:notification, notifiable: notifiable)
expect(notification.check_availability(notifiable)).to be(true)
expect(notification.check_availability(notifiable)).to be true
end
it "returns false if the resource is not present" do
notification = create(:notification, notifiable: notifiable)
notifiable.really_destroy!
expect(notification.check_availability(notifiable)).to be(false)
expect(notification.check_availability(notifiable)).to be false
end
it "returns false if the resource is not hidden" do
notification = create(:notification, notifiable: notifiable)
notifiable.hide
expect(notification.check_availability(notifiable)).to be(false)
expect(notification.check_availability(notifiable)).to be false
end
it "returns false if the resource is retired" do
@@ -74,7 +74,7 @@ shared_examples "notifiable" do
if notifiable.respond_to?(:retired_at)
notifiable.update!(retired_at: Time.current, retired_reason: "unfeasible",
retired_explanation: "Unfeasibility explanation ...")
expect(notification.check_availability(notifiable)).to be(false)
expect(notification.check_availability(notifiable)).to be false
end
end
end