From 8b55d32640764fc0d84ecaf8da104ba8f1db52d7 Mon Sep 17 00:00:00 2001 From: Anna Buianova Date: Thu, 6 Jun 2019 16:48:14 +0300 Subject: [PATCH] Rubocop fixes (#3058) --- app/helpers/articles_helper.rb | 1 - app/liquid_tags/medium_tag.rb | 2 +- app/models/chat_channel_membership.rb | 2 +- spec/models/article_spec.rb | 3 +-- spec/system/articles/user_visits_articles_by_tag_spec.rb | 2 +- spec/system/homepage/user_visits_homepage_articles_spec.rb | 1 - spec/system/organization/user_views_an_organization_spec.rb | 2 +- 7 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/helpers/articles_helper.rb b/app/helpers/articles_helper.rb index a7c7f2f2d..5f2b841ef 100644 --- a/app/helpers/articles_helper.rb +++ b/app/helpers/articles_helper.rb @@ -52,5 +52,4 @@ module ArticlesHelper host.gsub!("medium.com", "Medium") if host.include?("medium.com") host.start_with?("www.") ? host[4..-1] : host end - end diff --git a/app/liquid_tags/medium_tag.rb b/app/liquid_tags/medium_tag.rb index a02275b1c..1414965a1 100644 --- a/app/liquid_tags/medium_tag.rb +++ b/app/liquid_tags/medium_tag.rb @@ -33,4 +33,4 @@ class MediumTag < LiquidTagBase end end -Liquid::Template.register_tag("medium", MediumTag) \ No newline at end of file +Liquid::Template.register_tag("medium", MediumTag) diff --git a/app/models/chat_channel_membership.rb b/app/models/chat_channel_membership.rb index 577a50b24..01d503ea2 100644 --- a/app/models/chat_channel_membership.rb +++ b/app/models/chat_channel_membership.rb @@ -62,7 +62,7 @@ class ChatChannelMembership < ApplicationRecord def channel_color if chat_channel.channel_type == "direct" - other_user&.decorate.darker_color + other_user&.decorate&.darker_color else "#111111" end diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb index aefbca017..c976237ce 100644 --- a/spec/models/article_spec.rb +++ b/spec/models/article_spec.rb @@ -311,13 +311,12 @@ RSpec.describe Article, type: :model do expect(article.has_frontmatter?).to eq(true) end - it "determines that an article has frontmatter" do + it "determines that an article doesn't have frontmatter" do body = "Hey hey Ho Ho" article.body_markdown = body expect(article.has_frontmatter?).to eq(false) end - it "returns stripped canonical url" do article.canonical_url = " http://google.com " expect(article.decorate.processed_canonical_url).to eq("http://google.com") diff --git a/spec/system/articles/user_visits_articles_by_tag_spec.rb b/spec/system/articles/user_visits_articles_by_tag_spec.rb index 292c3fe11..86c3bd158 100644 --- a/spec/system/articles/user_visits_articles_by_tag_spec.rb +++ b/spec/system/articles/user_visits_articles_by_tag_spec.rb @@ -53,7 +53,7 @@ RSpec.describe "User visits articles by tag", type: :system do end context "when more articles" do - before do + it "visits ok" do create_list(:article, 3, tags: "javascript", user: author, published_at: Time.current) visit "/t/javascript" end diff --git a/spec/system/homepage/user_visits_homepage_articles_spec.rb b/spec/system/homepage/user_visits_homepage_articles_spec.rb index 4cb7458d3..2e52dffff 100644 --- a/spec/system/homepage/user_visits_homepage_articles_spec.rb +++ b/spec/system/homepage/user_visits_homepage_articles_spec.rb @@ -4,7 +4,6 @@ RSpec.describe "User visits a homepage", type: :system do let!(:article) { create(:article, reactions_count: 12, featured: true) } let!(:article2) { create(:article, reactions_count: 20, featured: true) } let!(:bad_article) { create(:article, reactions_count: 0) } - let!(:user) { create(:user) } let!(:timestamp) { "2019-03-04T10:00:00Z" } context "when no options specified" do diff --git a/spec/system/organization/user_views_an_organization_spec.rb b/spec/system/organization/user_views_an_organization_spec.rb index d059b4f5b..44af3a761 100644 --- a/spec/system/organization/user_views_an_organization_spec.rb +++ b/spec/system/organization/user_views_an_organization_spec.rb @@ -36,7 +36,7 @@ RSpec.describe "Organization index", type: :system do end context "when more articles" do - before do + it "visits ok" do create_list(:article, 3, organization: organization) visit "/#{organization.slug}" end