Bump rubocop-rspec from 2.3.0 to 2.4.0 (#13951)
* Bump rubocop-rspec from 2.3.0 to 2.4.0 Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/rubocop/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.3.0...v2.4.0) --- updated-dependencies: - dependency-name: rubocop-rspec dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Enable new cops, fix violations and refactor specs * Remove expected "Moderate" text from the /mod page test Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: rhymes <github@rhymes.dev> Co-authored-by: Dan Uber <dan@forem.com>
This commit is contained in:
parent
18a2a98b7a
commit
1ea169a351
18 changed files with 80 additions and 39 deletions
10
.rubocop.yml
10
.rubocop.yml
|
|
@ -894,6 +894,11 @@ RSpec/ExampleLength:
|
|||
Max: 15
|
||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
|
||||
|
||||
RSpec/IdenticalEqualityAssertion:
|
||||
Description: Checks for equality assertions with identical expressions on both sides.
|
||||
Enabled: true
|
||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
|
||||
|
||||
RSpec/MessageExpectation:
|
||||
Description: Checks for consistent message expectation style.
|
||||
Enabled: true
|
||||
|
|
@ -909,3 +914,8 @@ RSpec/MultipleExpectations:
|
|||
Enabled: true
|
||||
Max: 8
|
||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
|
||||
|
||||
RSpec/Rails/AvoidSetupHook:
|
||||
Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
|
||||
Enabled: true
|
||||
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook
|
||||
|
|
|
|||
2
Gemfile
2
Gemfile
|
|
@ -150,7 +150,7 @@ group :development, :test do
|
|||
gem "rubocop", "~> 1.16", require: false # Automatic Ruby code style checking tool
|
||||
gem "rubocop-performance", "~> 1.11", require: false # A collection of RuboCop cops to check for performance optimizations in Ruby code
|
||||
gem "rubocop-rails", "~> 2.10", require: false # Automatic Rails code style checking tool
|
||||
gem "rubocop-rspec", "~> 2.3", require: false # Code style checking for RSpec files
|
||||
gem "rubocop-rspec", "~> 2.4", require: false # Code style checking for RSpec files
|
||||
gem "sassc-rails", "~> 2.1.2" # Integrate SassC-Ruby into Rails
|
||||
gem "spring", "~> 2.1" # Preloads your application so things like console, rake and tests run faster
|
||||
gem "spring-commands-rspec", "~> 1.0" # rspec command for spring
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ GEM
|
|||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.7.0, < 2.0)
|
||||
rubocop-rspec (2.3.0)
|
||||
rubocop-rspec (2.4.0)
|
||||
rubocop (~> 1.0)
|
||||
rubocop-ast (>= 1.1.0)
|
||||
ruby-next-core (0.12.0)
|
||||
|
|
@ -954,7 +954,7 @@ DEPENDENCIES
|
|||
rubocop (~> 1.16)
|
||||
rubocop-performance (~> 1.11)
|
||||
rubocop-rails (~> 2.10)
|
||||
rubocop-rspec (~> 2.3)
|
||||
rubocop-rspec (~> 2.4)
|
||||
ruby-prof (~> 1.4)
|
||||
rubyzip (~> 2.3)
|
||||
s3_direct_upload (~> 0.1)
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ Rails.application.routes.draw do
|
|||
get "/t/:tag/:timeframe", to: "stories/tagged_articles#index",
|
||||
constraints: { timeframe: /latest/ }
|
||||
|
||||
get "/t/:tag/edit", to: "tags#edit"
|
||||
get "/t/:tag/edit", to: "tags#edit", as: :edit_tag
|
||||
get "/t/:tag/admin", to: "tags#admin"
|
||||
patch "/tag/:id", to: "tags#update"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ RSpec.describe CommentTag, type: :liquid_tag do
|
|||
create(:comment, commentable: article, user: user, body_markdown: "TheComment")
|
||||
end
|
||||
|
||||
setup { Liquid::Template.register_tag("comment", described_class) }
|
||||
before { Liquid::Template.register_tag("comment", described_class) }
|
||||
|
||||
def generate_comment_tag(id_code)
|
||||
Liquid::Template.parse("{% comment #{id_code} %}")
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require "rails_helper"
|
|||
RSpec.describe LiquidTagBase, type: :liquid_tag do
|
||||
# #new and #initialize are both private methods in Liquid::Tag, which is what
|
||||
# LiquidTagBase inherits from, so we treat this class as a liquid tag itself.
|
||||
setup { Liquid::Template.register_tag("liquid_tag_base", described_class) }
|
||||
before { Liquid::Template.register_tag("liquid_tag_base", described_class) }
|
||||
|
||||
context "when VALID_CONTEXTS are defined" do
|
||||
before { stub_const("#{described_class}::VALID_CONTEXTS", %w[Article]) }
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe MediumTag, type: :liquid_tag do
|
||||
setup { Liquid::Template.register_tag("medium", described_class) }
|
||||
|
||||
subject { Liquid::Template.parse("{% medium #{link} %}") }
|
||||
|
||||
before { Liquid::Template.register_tag("medium", described_class) }
|
||||
|
||||
let(:stubbed_scraper) { instance_double("MediumArticleRetrievalService") }
|
||||
let(:medium_link) { "https://medium.com/@edisonywh/my-ruby-journey-hooking-things-up-91d757e1c59c" }
|
||||
let(:response) do
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ RSpec.describe NullTag, type: :liquid_tag do
|
|||
describe "#initialize" do
|
||||
tags = %w[assign capture case cycle for if ifchanged include unless]
|
||||
|
||||
setup { tags.each { |tag| Liquid::Template.register_tag(tag, described_class) } }
|
||||
before { tags.each { |tag| Liquid::Template.register_tag(tag, described_class) } }
|
||||
|
||||
def generate_given_tag(tag)
|
||||
Liquid::Template.parse("{% #{tag} %}")
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require "rails_helper"
|
|||
RSpec.describe OrganizationTag, type: :liquid_tag do
|
||||
let(:organization) { create(:organization) }
|
||||
|
||||
setup { Liquid::Template.register_tag("organization", described_class) }
|
||||
before { Liquid::Template.register_tag("organization", described_class) }
|
||||
|
||||
def generate_user_tag(id_code)
|
||||
Liquid::Template.parse("{% organization #{id_code} %}")
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require "rails_helper"
|
|||
RSpec.describe TagTag, type: :liquid_tag do
|
||||
let(:tag) { create(:tag) }
|
||||
|
||||
setup { Liquid::Template.register_tag("tag", described_class) }
|
||||
before { Liquid::Template.register_tag("tag", described_class) }
|
||||
|
||||
def generate_tag_tag(id_code)
|
||||
Liquid::Template.parse("{% tag #{id_code} %}")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ RSpec.describe TweetTag, type: :liquid_tag do
|
|||
let(:name) { "DEV Community" }
|
||||
let(:body) { "When GitHub goes down" }
|
||||
|
||||
setup { Liquid::Template.register_tag("tweet", described_class) }
|
||||
before { Liquid::Template.register_tag("tweet", described_class) }
|
||||
|
||||
def generate_tweet_liquid_tag(id)
|
||||
Liquid::Template.parse("{% tweet #{id} %}")
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe UserSubscriptionTag, type: :liquid_tag do
|
||||
setup { Liquid::Template.register_tag("user_subscription", described_class) }
|
||||
|
||||
let(:subscriber) { create(:user) }
|
||||
let(:author) { create(:user) }
|
||||
let(:article_with_user_subscription_tag) do
|
||||
create(:article, :with_user_subscription_tag_role_user, with_user_subscription_tag: true)
|
||||
end
|
||||
|
||||
# Stub roles because adding them normally can cause flaky specs
|
||||
before do
|
||||
Liquid::Template.register_tag("user_subscription", described_class)
|
||||
|
||||
# Stub roles because adding them normally can cause flaky specs
|
||||
allow(author).to receive(:has_role?).and_call_original
|
||||
allow(author).to receive(:has_role?).with(:restricted_liquid_tag, LiquidTags::UserSubscriptionTag).and_return(true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe UserTag, type: :liquid_tag do
|
||||
let(:user) { create(:user) }
|
||||
let(:user) { create(:user) }
|
||||
|
||||
setup { Liquid::Template.register_tag("user", described_class) }
|
||||
before { Liquid::Template.register_tag("user", described_class) }
|
||||
|
||||
def generate_user_tag(id_code)
|
||||
Liquid::Template.parse("{% user #{id_code} %}")
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@ require "rails_helper"
|
|||
|
||||
RSpec.describe "Admin updates a tag", type: :system do
|
||||
let(:super_admin) { create(:user, :super_admin) }
|
||||
let(:tag) { create(:tag) }
|
||||
let(:bg_color_hex) { "#000000" }
|
||||
let(:text_color_hex) { "#ffffff" }
|
||||
|
||||
context "when no colors have been choosen for the tag" do
|
||||
let(:tag) { create(:tag) }
|
||||
|
||||
before do
|
||||
sign_in super_admin
|
||||
visit edit_admin_tag_path(tag.id)
|
||||
|
|
@ -15,24 +18,32 @@ RSpec.describe "Admin updates a tag", type: :system do
|
|||
end
|
||||
|
||||
it "defaults to black and white upon update" do
|
||||
check "Supported"
|
||||
check("Supported")
|
||||
click_button("Update Tag")
|
||||
|
||||
tag.reload
|
||||
expect(tag.bg_color_hex).to eq("#000000")
|
||||
expect(tag.text_color_hex).to eq("#ffffff")
|
||||
|
||||
expect(tag.bg_color_hex).to eq(bg_color_hex)
|
||||
expect(tag.text_color_hex).to eq(text_color_hex)
|
||||
end
|
||||
end
|
||||
|
||||
context "when colors have already been choosen for the tag" do
|
||||
let(:tag) { create(:tag, bg_color_hex: "#0000ff", text_color_hex: "#ff0000") }
|
||||
|
||||
before do
|
||||
sign_in super_admin
|
||||
visit edit_admin_tag_path(tag)
|
||||
end
|
||||
|
||||
it "remains the same color it was unless otherwise updated via the color picker" do
|
||||
old_bg_color_hex = tag.bg_color_hex
|
||||
old_text_color_hex = tag.text_color_hex
|
||||
|
||||
click_button("Update Tag")
|
||||
expect(tag.bg_color_hex).to eq(tag.bg_color_hex)
|
||||
expect(tag.text_color_hex).to eq(tag.text_color_hex)
|
||||
|
||||
expect(tag.reload.bg_color_hex).to eq(old_bg_color_hex)
|
||||
expect(tag.reload.text_color_hex).to eq(old_text_color_hex)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ RSpec.describe "Views an article", type: :system do
|
|||
it "lets moderators visit /mod", js: true do
|
||||
visit "/#{user.username}/#{article.slug}/mod"
|
||||
|
||||
expect(page).to have_content("Moderate: #{article.title}")
|
||||
expect(page).to have_selector('button[data-category="thumbsdown"][data-reactable-type="Article"]')
|
||||
expect(page).to have_selector('button[data-category="vomit"][data-reactable-type="Article"]')
|
||||
expect(page).to have_selector('button[data-category="vomit"][data-reactable-type="User"]')
|
||||
|
|
@ -3,13 +3,16 @@ require "rails_helper"
|
|||
RSpec.describe "User updates a tag", type: :system do
|
||||
let(:super_admin) { create(:user, :super_admin) }
|
||||
let(:tag_moderator) { create(:user) }
|
||||
let(:tag) { create(:tag) }
|
||||
let(:bg_color_hex) { "#000000" }
|
||||
let(:text_color_hex) { "#ffffff" }
|
||||
|
||||
describe "Update tag as a super_admin" do
|
||||
let(:tag) { create(:tag) }
|
||||
|
||||
describe "UPDATE /t/:tag/edit as a super_admin" do
|
||||
context "when no colors have been choosen for the tag" do
|
||||
before do
|
||||
sign_in super_admin
|
||||
visit "/t/#{tag}/edit"
|
||||
visit edit_tag_path(tag.name)
|
||||
end
|
||||
|
||||
it "defaults to white text for the color picker" do
|
||||
|
|
@ -18,32 +21,42 @@ RSpec.describe "User updates a tag", type: :system do
|
|||
|
||||
it "defaults to black and white upon update", :aggregate_failures do
|
||||
click_button("SAVE CHANGES")
|
||||
|
||||
tag.reload
|
||||
expect(tag.bg_color_hex).to eq("#000000")
|
||||
expect(tag.text_color_hex).to eq("#ffffff")
|
||||
|
||||
expect(tag.bg_color_hex).to eq(bg_color_hex)
|
||||
expect(tag.text_color_hex).to eq(text_color_hex)
|
||||
end
|
||||
end
|
||||
|
||||
context "when colors have already been choosen for the tag" do
|
||||
let(:tag) { create(:tag, bg_color_hex: "#0000ff", text_color_hex: "#ff0000") }
|
||||
|
||||
before do
|
||||
sign_in super_admin
|
||||
visit "/t/#{tag}/edit"
|
||||
visit edit_tag_path(tag.name)
|
||||
end
|
||||
|
||||
it "remains the same color it was unless otherwise updated via the color picker", :aggregate_failures do
|
||||
old_bg_color_hex = tag.bg_color_hex
|
||||
old_text_color_hex = tag.text_color_hex
|
||||
|
||||
click_button("SAVE CHANGES")
|
||||
expect(tag.bg_color_hex).to eq(tag.bg_color_hex)
|
||||
expect(tag.text_color_hex).to eq(tag.text_color_hex)
|
||||
|
||||
expect(tag.reload.bg_color_hex).to eq(old_bg_color_hex)
|
||||
expect(tag.reload.text_color_hex).to eq(old_text_color_hex)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "UPDATE /t/:tag/edit as a tag_moderator" do
|
||||
describe "Update tag as a tag_moderator" do
|
||||
let(:tag) { create(:tag) }
|
||||
|
||||
context "when no colors have been choosen for the tag" do
|
||||
before do
|
||||
tag_moderator.add_role(:tag_moderator, tag)
|
||||
sign_in tag_moderator
|
||||
visit "/t/#{tag}/edit"
|
||||
visit edit_tag_path(tag.name)
|
||||
end
|
||||
|
||||
it "defaults to white text for the color picker" do
|
||||
|
|
@ -52,23 +65,31 @@ RSpec.describe "User updates a tag", type: :system do
|
|||
|
||||
it "defaults to black and white upon update", :aggregate_failures do
|
||||
click_button("SAVE CHANGES")
|
||||
|
||||
tag.reload
|
||||
expect(tag.bg_color_hex).to eq("#000000")
|
||||
expect(tag.text_color_hex).to eq("#ffffff")
|
||||
|
||||
expect(tag.bg_color_hex).to eq(bg_color_hex)
|
||||
expect(tag.text_color_hex).to eq(text_color_hex)
|
||||
end
|
||||
end
|
||||
|
||||
context "when colors have already been choosen for the tag" do
|
||||
let(:tag) { create(:tag, bg_color_hex: "#0000ff", text_color_hex: "#ff0000") }
|
||||
|
||||
before do
|
||||
tag_moderator.add_role(:tag_moderator, tag)
|
||||
sign_in tag_moderator
|
||||
visit "/t/#{tag}/edit"
|
||||
visit edit_tag_path(tag.name)
|
||||
end
|
||||
|
||||
it "remains the same color it was unless otherwise updated via the color picker", :aggregate_failures do
|
||||
old_bg_color_hex = tag.bg_color_hex
|
||||
old_text_color_hex = tag.text_color_hex
|
||||
|
||||
click_button("SAVE CHANGES")
|
||||
expect(tag.bg_color_hex).to eq(tag.bg_color_hex)
|
||||
expect(tag.text_color_hex).to eq(tag.text_color_hex)
|
||||
|
||||
expect(tag.reload.bg_color_hex).to eq(old_bg_color_hex)
|
||||
expect(tag.reload.text_color_hex).to eq(old_text_color_hex)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
BIN
vendor/cache/rubocop-rspec-2.3.0.gem
vendored
BIN
vendor/cache/rubocop-rspec-2.3.0.gem
vendored
Binary file not shown.
BIN
vendor/cache/rubocop-rspec-2.4.0.gem
vendored
Normal file
BIN
vendor/cache/rubocop-rspec-2.4.0.gem
vendored
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue