Routine rubocop fixes (#9155)
* Refactoring and rubocop -a * rubocop --auto-gen-config
This commit is contained in:
parent
a1c97fdf88
commit
a3bfb375ef
2 changed files with 22 additions and 15 deletions
|
|
@ -6,7 +6,7 @@ require:
|
|||
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2020-06-30 07:14:27 UTC using RuboCop version 0.86.0.
|
||||
# on 2020-07-06 08:14:17 UTC using RuboCop version 0.86.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
|
|
@ -44,7 +44,7 @@ RSpec/ExampleLength:
|
|||
- 'spec/models/comment_spec.rb'
|
||||
- 'spec/requests/display_ad_events_spec.rb'
|
||||
|
||||
# Offense count: 907
|
||||
# Offense count: 920
|
||||
RSpec/MultipleExpectations:
|
||||
Max: 12
|
||||
|
||||
|
|
|
|||
|
|
@ -68,12 +68,14 @@ RSpec.describe "Articles", type: :request do
|
|||
shared_context "when user/organization articles exist" do
|
||||
let(:user) { create(:user) }
|
||||
let(:organization) { create(:organization) }
|
||||
let!(:user_article) { create(:article, user: user) }
|
||||
let!(:organization_article) { create(:article, organization: organization) }
|
||||
end
|
||||
|
||||
context "when :username param is given and belongs to a user" do
|
||||
include_context "when user/organization articles exist"
|
||||
|
||||
let!(:user_article) { create(:article, user: user) }
|
||||
let!(:organization_article) { create(:article, organization: organization) }
|
||||
|
||||
before { get user_feed_path(user.username) }
|
||||
|
||||
it "returns only articles for that user" do
|
||||
|
|
@ -88,6 +90,10 @@ RSpec.describe "Articles", type: :request do
|
|||
|
||||
context "when :username param is given and belongs to an organization" do
|
||||
include_context "when user/organization articles exist"
|
||||
|
||||
let!(:user_article) { create(:article, user: user) }
|
||||
let!(:organization_article) { create(:article, organization: organization) }
|
||||
|
||||
before { get user_feed_path(organization.slug) }
|
||||
|
||||
it "returns only articles for that organization" do
|
||||
|
|
@ -101,8 +107,6 @@ RSpec.describe "Articles", type: :request do
|
|||
end
|
||||
|
||||
context "when :username param is given but it belongs to neither user nor organization" do
|
||||
include_context "when user/organization articles exist"
|
||||
|
||||
it "renders empty body" do
|
||||
expect do
|
||||
get feed_path("unknown")
|
||||
|
|
@ -127,15 +131,14 @@ RSpec.describe "Articles", type: :request do
|
|||
end
|
||||
|
||||
describe "GET /feed/tag" do
|
||||
shared_context "when tagged articles exist" do
|
||||
let!(:tag_article) { create(:article, tags: tag.name) }
|
||||
end
|
||||
|
||||
context "when :tag param is given and tag exists" do
|
||||
include_context "when tagged articles exist"
|
||||
before do
|
||||
create(:article, tags: tag.name)
|
||||
end
|
||||
|
||||
it "returns only articles for that tag" do
|
||||
article = create(:article, tags: ["foobar"])
|
||||
# tag_article = create(:article, tags: tag.name)
|
||||
|
||||
get tag_feed_path(tag.name)
|
||||
|
||||
|
|
@ -143,6 +146,8 @@ RSpec.describe "Articles", type: :request do
|
|||
titles = rss_feed.entries.map(&:title)
|
||||
|
||||
expect(titles).not_to include(article.title)
|
||||
|
||||
tag_article = Article.cached_tagged_with(tag.name).take
|
||||
expect(titles).to include(tag_article.title)
|
||||
end
|
||||
|
||||
|
|
@ -161,21 +166,23 @@ RSpec.describe "Articles", type: :request do
|
|||
end
|
||||
|
||||
context "when :tag param is given and tag exists and is an alias" do
|
||||
include_context "when tagged articles exist"
|
||||
before do
|
||||
create(:article, tags: tag.name)
|
||||
alias_tag = create(:tag, alias_for: tag.name)
|
||||
get "/feed/tag/#{alias_tag.name}"
|
||||
end
|
||||
|
||||
it "returns only articles for the aliased for tag" do
|
||||
tag_article = Article.cached_tagged_with(tag.name).take
|
||||
|
||||
expect(response.body).to include(tag_article.title)
|
||||
end
|
||||
end
|
||||
|
||||
context "when :tag param is given and tag does not exist" do
|
||||
include_context "when tagged articles exist"
|
||||
|
||||
it("renders empty body") { expect { get "/feed/tag/unknown" }.to raise_error(ActiveRecord::RecordNotFound) }
|
||||
it "renders empty body" do
|
||||
expect { get "/feed/tag/unknown" }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue