Enable RSpec/ExpectActual cop and fix all issues
Always use a variable and not a literal as `expect` argument Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
This commit is contained in:
@@ -170,27 +170,27 @@ feature 'Moderate comments' do
|
||||
end
|
||||
|
||||
scenario "sorting comments" do
|
||||
create(:comment, body: "Flagged comment", created_at: Time.current - 1.day, flags_count: 5)
|
||||
create(:comment, body: "Flagged newer comment", created_at: Time.current - 12.hours, flags_count: 3)
|
||||
create(:comment, body: "Newer comment", created_at: Time.current)
|
||||
flagged_comment = create(:comment, body: "Flagged comment", created_at: Time.current - 1.day, flags_count: 5)
|
||||
flagged_new_comment = create(:comment, body: "Flagged new comment", created_at: Time.current - 12.hours, flags_count: 3)
|
||||
newer_comment = create(:comment, body: "Newer comment", created_at: Time.current)
|
||||
|
||||
visit moderation_comments_path(order: 'newest')
|
||||
|
||||
expect("Flagged newer comment").to appear_before("Flagged comment")
|
||||
expect(flagged_new_comment.body).to appear_before(flagged_comment.body)
|
||||
|
||||
visit moderation_comments_path(order: 'flags')
|
||||
|
||||
expect("Flagged comment").to appear_before("Flagged newer comment")
|
||||
expect(flagged_comment.body).to appear_before(flagged_new_comment.body)
|
||||
|
||||
visit moderation_comments_path(filter: 'all', order: 'newest')
|
||||
|
||||
expect("Newer comment").to appear_before("Flagged newer comment")
|
||||
expect("Flagged newer comment").to appear_before("Flagged comment")
|
||||
expect(newer_comment.body).to appear_before(flagged_new_comment.body)
|
||||
expect(flagged_new_comment.body).to appear_before(flagged_comment.body)
|
||||
|
||||
visit moderation_comments_path(filter: 'all', order: 'flags')
|
||||
|
||||
expect("Flagged comment").to appear_before("Flagged newer comment")
|
||||
expect("Flagged newer comment").to appear_before("Newer comment")
|
||||
expect(flagged_comment.body).to appear_before(flagged_new_comment.body)
|
||||
expect(flagged_new_comment.body).to appear_before(newer_comment.body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user