Apply rubocop Rails/FindBy rule everywhere
We didn't detect these cases because by default the rule only searches for offenses in `app/models/`.
This commit is contained in:
@@ -399,7 +399,7 @@ describe Debate do
|
||||
describe "custom tag counters when hiding/restoring" do
|
||||
it "decreases the tag counter when hiden, and increases it when restored" do
|
||||
debate = create(:debate, tag_list: "foo")
|
||||
tag = Tag.where(name: "foo").first
|
||||
tag = Tag.find_by(name: "foo")
|
||||
expect(tag.debates_count).to eq(1)
|
||||
|
||||
debate.hide
|
||||
|
||||
@@ -117,8 +117,8 @@ describe Newsletter do
|
||||
expect(Activity.count).to eq(3)
|
||||
|
||||
recipients.each do |email|
|
||||
user = User.where(email: email).first
|
||||
activity = Activity.where(user: user).first
|
||||
user = User.find_by(email: email)
|
||||
activity = Activity.find_by(user: user)
|
||||
|
||||
expect(activity.user_id).to eq(user.id)
|
||||
expect(activity.action).to eq("email")
|
||||
|
||||
@@ -341,7 +341,7 @@ describe Proposal do
|
||||
describe "custom tag counters when hiding/restoring" do
|
||||
it "decreases the tag counter when hiden, and increases it when restored" do
|
||||
proposal = create(:proposal, tag_list: "foo")
|
||||
tag = Tag.where(name: "foo").first
|
||||
tag = Tag.find_by(name: "foo")
|
||||
expect(tag.proposals_count).to eq(1)
|
||||
|
||||
proposal.hide
|
||||
|
||||
Reference in New Issue
Block a user