From 842e6880b8055772037dfaed861c1c900db3f41a Mon Sep 17 00:00:00 2001 From: Mac Siri Date: Tue, 21 Mar 2023 09:55:26 -0400 Subject: [PATCH] Routine rubocop fix on /spec (#19217) * Softrun rubocop * Hardrun rubocop (-A) * Change a rubocop rule * Add missing cops * Undo & redo rubocop -A --- .rubocop.yml | 10 ++-- spec/factories/github_repos.rb | 4 +- spec/factories/organizations.rb | 4 +- spec/factories/podcasts.rb | 2 +- spec/factories/response_templates.rb | 2 +- spec/factories/tags.rb | 2 +- spec/factories/users.rb | 8 ++-- spec/generator/services_generator_spec.rb | 2 +- spec/helpers/application_helper_spec.rb | 2 +- spec/helpers/authentication_helper_spec.rb | 2 +- spec/helpers/crayons_helper_spec.rb | 2 +- spec/helpers/display_ad_helper_spec.rb | 2 +- spec/helpers/feedback_messages_helper_spec.rb | 2 +- spec/helpers/listing_helper_spec.rb | 2 +- spec/helpers/organization_helper_spec.rb | 2 +- .../helpers/rate_limit_checker_helper_spec.rb | 2 +- ...ename_moderator_to_super_moderator_spec.rb | 8 ++-- spec/mailers/application_mailer_spec.rb | 2 +- spec/mailers/devise_mailer_spec.rb | 2 +- spec/mailers/digest_mailer_spec.rb | 2 +- spec/mailers/notify_mailer_spec.rb | 2 +- spec/mailers/verification_mailer_spec.rb | 2 +- spec/models/ahoy/visit_spec.rb | 2 +- spec/models/api_secret_spec.rb | 2 +- spec/models/application_record_spec.rb | 2 +- spec/models/article_destroy_spec.rb | 2 +- spec/models/articles/cached_entity_spec.rb | 2 +- spec/models/audit_log_spec.rb | 2 +- spec/models/badge_achievement_spec.rb | 2 +- spec/models/badge_spec.rb | 2 +- spec/models/banished_user_spec.rb | 2 +- spec/models/broadcast_spec.rb | 2 +- spec/models/collection_spec.rb | 2 +- spec/models/consumer_app_spec.rb | 2 +- spec/models/context_notification_spec.rb | 2 +- spec/models/credit_spec.rb | 2 +- spec/models/device_spec.rb | 2 +- spec/models/discussion_lock_spec.rb | 2 +- spec/models/display_ad_event_spec.rb | 2 +- spec/models/email_authorization_spec.rb | 2 +- spec/models/email_message_spec.rb | 2 +- spec/models/feedback_message_spec.rb | 2 +- spec/models/follow_spec.rb | 2 +- spec/models/forem_instance_spec.rb | 2 +- spec/models/github_issue_spec.rb | 2 +- spec/models/github_repo_spec.rb | 2 +- spec/models/html_variant_spec.rb | 2 +- spec/models/identity_spec.rb | 2 +- spec/models/listing_category_spec.rb | 2 +- spec/models/listing_spec.rb | 2 +- spec/models/mention_spec.rb | 2 +- spec/models/navigation_link_spec.rb | 2 +- spec/models/note_spec.rb | 2 +- spec/models/notification_spec.rb | 2 +- spec/models/notification_subscription_spec.rb | 2 +- spec/models/organization_membership_spec.rb | 2 +- spec/models/page_spec.rb | 2 +- spec/models/page_view_spec.rb | 2 +- spec/models/pinned_article_spec.rb | 2 +- .../models/podcast_episode_appearance_spec.rb | 2 +- spec/models/podcast_episode_spec.rb | 2 +- spec/models/podcast_ownership_spec.rb | 2 +- spec/models/podcast_spec.rb | 2 +- spec/models/poll_option_spec.rb | 2 +- spec/models/poll_skip_spec.rb | 2 +- spec/models/poll_spec.rb | 2 +- spec/models/poll_vote_spec.rb | 2 +- spec/models/profile_field_group_spec.rb | 2 +- spec/models/profile_field_spec.rb | 2 +- spec/models/profile_pin_spec.rb | 2 +- spec/models/profile_spec.rb | 2 +- spec/models/rating_vote_spec.rb | 2 +- spec/models/response_template_spec.rb | 2 +- spec/models/role_spec.rb | 2 +- spec/models/settings/authentication_spec.rb | 2 +- spec/models/settings/base_spec.rb | 2 +- spec/models/settings/general_spec.rb | 2 +- spec/models/settings/rate_limit_spec.rb | 2 +- spec/models/tag_adjustment_spec.rb | 2 +- spec/models/tag_spec.rb | 2 +- spec/models/timeframe_spec.rb | 2 +- spec/models/tweet_spec.rb | 2 +- spec/models/user_block_spec.rb | 2 +- spec/models/user_role_spec.rb | 2 +- spec/models/users/deleted_user_spec.rb | 2 +- .../models/users/notification_setting_spec.rb | 2 +- spec/models/users/setting_spec.rb | 2 +- spec/models/users/suspended_username_spec.rb | 2 +- spec/queries/admin/users_query_spec.rb | 4 +- .../comments/community_wellness_query_spec.rb | 4 +- spec/requests/admin/reactions_spec.rb | 4 +- spec/requests/api/v0/analytics_spec.rb | 4 +- spec/requests/api/v0/feature_flags_spec.rb | 2 +- spec/requests/api/v1/analytics_spec.rb | 4 +- spec/requests/api/v1/feature_flags_spec.rb | 2 +- spec/requests/api/v1/reactions_spec.rb | 8 ++-- spec/requests/follows_create_spec.rb | 6 +-- .../notification_subscriptions_spec.rb | 4 +- spec/requests/poll_votes_spec.rb | 30 ++++++------ spec/requests/response_templates_spec.rb | 8 ++-- .../comment_hide_or_unhide_request.rb | 2 +- spec/requests/tags_spec.rb | 2 +- spec/requests/universal_links_spec.rb | 6 +-- spec/routing/all_routes_spec.rb | 2 +- .../data_update_scripts_admin_routes_spec.rb | 2 +- spec/routing/i18n_routes_spec.rb | 2 +- spec/routing/profile_admin_routes_spec.rb | 2 +- spec/services/bulk_sql_delete_spec.rb | 4 +- .../calculate_reaction_points_spec.rb | 6 +-- spec/services/comment_creator_spec.rb | 4 +- spec/services/display_ad_event_rollup_spec.rb | 8 ++-- .../notifications/new_follower/send_spec.rb | 2 +- .../welcome_notification/send_spec.rb | 2 +- .../podcasts/episode_rss_item_spec.rb | 2 +- spec/services/search/username_spec.rb | 12 ++--- spec/support/initializers/capybara.rb | 24 +++++----- spec/support/seeds/seeds_e2e.rb | 46 +++++++++---------- spec/system/admin/admin_awards_badges_spec.rb | 4 +- .../admin/admin_creates_new_page_spec.rb | 2 +- .../admin/admin_creates_new_tag_spec.rb | 2 +- spec/system/admin/admin_deletes_user_spec.rb | 2 +- spec/system/admin/admin_invites_user_spec.rb | 2 +- .../admin/admin_manages_organizations_spec.rb | 6 +-- spec/system/admin/admin_manages_pages_spec.rb | 2 +- .../admin_manages_profile_fields_spec.rb | 2 +- .../admin/admin_manages_reports_spec.rb | 2 +- spec/system/admin/admin_updates_tag_spec.rb | 2 +- spec/system/admin/admin_views_tags_spec.rb | 2 +- .../admin/admin_visits_overview_spec.rb | 2 +- .../admin_updates_smtp_settings_spec.rb | 2 +- spec/system/articles/feeds/basic_spec.rb | 4 +- .../feeds/large_forem_experimental_spec.rb | 2 +- .../moderator_moderates_an_article_spec.rb | 4 +- .../articles/user_creates_an_article_spec.rb | 2 +- .../articles/user_deletes_an_article_spec.rb | 2 +- .../articles/user_discussion_locks_spec.rb | 2 +- .../articles/user_edits_an_article_spec.rb | 2 +- .../articles/user_visits_an_article_spec.rb | 4 +- .../user_visits_article_stats_spec.rb | 2 +- .../user_visits_articles_by_tag_spec.rb | 2 +- .../conditional_registration_spec.rb | 2 +- .../creator_config_edit_spec.rb | 2 +- .../omniauth_redirect_uri_spec.rb | 2 +- .../redirects_using_referer_spec.rb | 2 +- .../user_request_confirmation_spec.rb | 2 +- .../user_with_suspended_username_spec.rb | 2 +- spec/system/banned_user_interactions_spec.rb | 2 +- .../user_views_collection_articles_spec.rb | 2 +- .../user_views_collections_spec.rb | 2 +- .../comments/user_delete_a_comment_spec.rb | 2 +- .../comments/user_edits_a_comment_spec.rb | 2 +- .../comments/user_fills_out_comment_spec.rb | 4 +- .../comments/user_views_a_comment_spec.rb | 2 +- .../user_views_article_comments_spec.rb | 4 +- .../dashboards/user_followers_display_spec.rb | 2 +- ...ser_scrolls_down_dashboard_follows_spec.rb | 2 +- .../user_sorts_dashboard_articles_spec.rb | 2 +- .../dashboards/user_visits_dashboard_spec.rb | 2 +- spec/system/feedback_message_spec.rb | 2 +- .../user_visits_homepage_articles_spec.rb | 2 +- .../homepage/user_visits_homepage_spec.rb | 2 +- ..._visits_homepage_with_announcement_spec.rb | 2 +- ...for_tags_in_posts_in_notifications_spec.rb | 2 +- .../notifications/notifications_page_spec.rb | 2 +- .../user_completes_onboarding_spec.rb | 2 +- .../user_leaves_an_organization_spec.rb | 2 +- .../user_updates_org_settings_spec.rb | 2 +- .../user_views_an_organization_spec.rb | 2 +- .../user_visits_podcast_episode_spec.rb | 6 +-- .../podcasts/user_visits_podcast_page_spec.rb | 2 +- .../user_visits_podcasts_root_page_spec.rb | 2 +- .../search/display_articles_search_spec.rb | 2 +- .../search/display_comments_search_spec.rb | 2 +- .../search/display_users_search_spec.rb | 2 +- spec/system/search/search_title_spec.rb | 2 +- .../system/search/user_searches_users_spec.rb | 2 +- spec/system/tags/user_updates_a_tag_spec.rb | 2 +- .../user/trusted_user_flags_user_spec.rb | 4 +- .../user/user_edits_customization_spec.rb | 2 +- .../system/user/user_edits_extensions_spec.rb | 2 +- spec/system/user/user_edits_profile_spec.rb | 2 +- spec/system/user/user_self_destroy_spec.rb | 2 +- .../user_settings_response_templates_spec.rb | 2 +- spec/system/user/view_user_comments_spec.rb | 2 +- spec/system/user/view_user_index_spec.rb | 2 +- spec/system/user_uses_the_editor_spec.rb | 4 +- spec/system/user_views_a_reading_list_spec.rb | 2 +- spec/system/user_views_logo_spec.rb | 2 +- .../user_visits_a_comments_page_spec.rb | 2 +- spec/system/videos/user_visits_videos_spec.rb | 2 +- spec/view_objects/cloud_cover_url_spec.rb | 2 +- spec/views/articles_spec.rb | 2 +- spec/views/comments/_comment.html.erb_spec.rb | 2 +- spec/views/credits/new.html.erb_spec.rb | 2 +- spec/views/dashboards/show.html.erb_spec.rb | 2 +- .../unsubscribe.html.erb_spec.rb | 2 +- .../layouts/signup_modal.html.erb_spec.rb | 2 +- .../podcast_episodes/index.html.erb_spec.rb | 2 +- .../sign_in_invitation.html.erb_spec.rb | 2 +- spec/views/users/settings_spec.rb | 2 +- .../feeds/import_articles_worker_spec.rb | 2 +- .../update_relevant_scores_worker_spec.rb | 2 +- 202 files changed, 300 insertions(+), 302 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 412cc4c74..903f1c7b7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,6 +6,7 @@ require: - rubocop-performance - rubocop-rails - rubocop-rspec + - rubocop-capybara AllCops: Exclude: @@ -925,10 +926,11 @@ RSpec/DescribeClass: Enabled: true StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass Exclude: - - 'spec/requests/**/*' - - 'spec/system/**/*' - - 'spec/tasks/**/*' - - 'spec/views/**/*' + - '**/spec/features/**/*' + - '**/spec/requests/**/*' + - '**/spec/routing/**/*' + - '**/spec/system/**/*' + - '**/spec/views/**/*' RSpec/DescribedClassModuleWrapping: Description: Avoid opening modules and defining specs within them. diff --git a/spec/factories/github_repos.rb b/spec/factories/github_repos.rb index 1a9c273fc..4f5e6e0bf 100644 --- a/spec/factories/github_repos.rb +++ b/spec/factories/github_repos.rb @@ -5,12 +5,12 @@ FactoryBot.define do factory :github_repo do user name { Faker::Book.title } - url { generate :url } + url { generate(:url) } description { Faker::Book.title } language { Faker::Book.title } bytes_size { rand(100_000) } watchers_count { rand(100_000) } - github_id_code { generate :github_id_code } + github_id_code { generate(:github_id_code) } stargazers_count { rand(100_000) } featured { true } fork { false } diff --git a/spec/factories/organizations.rb b/spec/factories/organizations.rb index 9aa488daf..3b76b86b9 100644 --- a/spec/factories/organizations.rb +++ b/spec/factories/organizations.rb @@ -4,10 +4,10 @@ FactoryBot.define do factory :organization do name { Faker::Company.name } summary { Faker::Hipster.paragraph(sentence_count: 1)[0..150] } - profile_image { File.open(Rails.root.join("app/assets/images/android-icon-36x36.png")) } + profile_image { Rails.root.join("app/assets/images/android-icon-36x36.png").open } nav_image { Faker::Avatar.image } url { Faker::Internet.url } - slug { generate :slug } + slug { generate(:slug) } github_username { "org#{rand(10_000)}" } twitter_username { "org#{rand(10_000)}" } bg_color_hex { Faker::Color.hex_color } diff --git a/spec/factories/podcasts.rb b/spec/factories/podcasts.rb index 663333c3c..73e1a1620 100644 --- a/spec/factories/podcasts.rb +++ b/spec/factories/podcasts.rb @@ -7,7 +7,7 @@ FactoryBot.define do title { Faker::Beer.name } image { Rack::Test::UploadedFile.new(image_path, "image/jpeg") } description { Faker::Hipster.paragraph(sentence_count: 1) } - slug { generate :podcast_slug } + slug { generate(:podcast_slug) } feed_url { Faker::Internet.url } main_color_hex { "ffffff" } published { true } diff --git a/spec/factories/response_templates.rb b/spec/factories/response_templates.rb index 6f47de3ed..239f4232e 100644 --- a/spec/factories/response_templates.rb +++ b/spec/factories/response_templates.rb @@ -5,6 +5,6 @@ FactoryBot.define do user type_of { "personal_comment" } content_type { "body_markdown" } - title { generate :title } + title { generate(:title) } end end diff --git a/spec/factories/tags.rb b/spec/factories/tags.rb index eb60d57bb..f0ebc731f 100644 --- a/spec/factories/tags.rb +++ b/spec/factories/tags.rb @@ -2,7 +2,7 @@ FactoryBot.define do sequence(:name) { |n| "tag#{n}" } factory :tag do - name { generate :name } + name { generate(:name) } supported { true } end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index f4165dcd1..5bfe944fa 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -12,11 +12,11 @@ FactoryBot.define do name do "#{Faker::Name.first_name} \"#{Faker::Name.first_name}\" \\:/ #{Faker::Name.last_name}" end - email { generate :email } - username { generate :username } + email { generate(:email) } + username { generate(:username) } profile_image { Rack::Test::UploadedFile.new(image_path, "image/jpeg") } - twitter_username { generate :twitter_username } - github_username { generate :github_username } + twitter_username { generate(:twitter_username) } + github_username { generate(:github_username) } confirmed_at { Time.current } saw_onboarding { true } checked_code_of_conduct { true } diff --git a/spec/generator/services_generator_spec.rb b/spec/generator/services_generator_spec.rb index f13658cb8..04b3b7a77 100644 --- a/spec/generator/services_generator_spec.rb +++ b/spec/generator/services_generator_spec.rb @@ -1,5 +1,5 @@ require "rails_helper" -RSpec.describe "Services", type: :generator do +RSpec.describe "Services" do pending "add some scenarios (or delete) #{__FILE__}" end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 3a5303a59..4b42f43ad 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ApplicationHelper, type: :helper do +RSpec.describe ApplicationHelper do include CloudinaryHelper describe "constant definitions" do diff --git a/spec/helpers/authentication_helper_spec.rb b/spec/helpers/authentication_helper_spec.rb index 69a1788fe..ffa6bb83b 100644 --- a/spec/helpers/authentication_helper_spec.rb +++ b/spec/helpers/authentication_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe AuthenticationHelper, type: :helper do +RSpec.describe AuthenticationHelper do let(:user) { create(:user, :with_identity) } before do diff --git a/spec/helpers/crayons_helper_spec.rb b/spec/helpers/crayons_helper_spec.rb index f29a34cc2..3cb1411c4 100644 --- a/spec/helpers/crayons_helper_spec.rb +++ b/spec/helpers/crayons_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe CrayonsHelper, type: :helper do +RSpec.describe CrayonsHelper do describe "#crayons_icon_tag" do let(:icon_tag) { helper.crayons_icon_tag("twitter.svg") } diff --git a/spec/helpers/display_ad_helper_spec.rb b/spec/helpers/display_ad_helper_spec.rb index c6d754b5f..ff2957bef 100644 --- a/spec/helpers/display_ad_helper_spec.rb +++ b/spec/helpers/display_ad_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe DisplayAdHelper, type: :helper do +describe DisplayAdHelper do describe ".display_ads_placement_area_options_array" do it "returns proper human value" do expect(helper.display_ads_placement_area_options_array[1]).to eq ["Sidebar Left (Second Position)", diff --git a/spec/helpers/feedback_messages_helper_spec.rb b/spec/helpers/feedback_messages_helper_spec.rb index d7d6e2d67..8618eee0f 100644 --- a/spec/helpers/feedback_messages_helper_spec.rb +++ b/spec/helpers/feedback_messages_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe FeedbackMessagesHelper, type: :helper do +RSpec.describe FeedbackMessagesHelper do describe "#offender_email_details" do it "has the proper subject and body" do expect(helper.offender_email_details).to include( diff --git a/spec/helpers/listing_helper_spec.rb b/spec/helpers/listing_helper_spec.rb index eb4a81581..c3c10730c 100644 --- a/spec/helpers/listing_helper_spec.rb +++ b/spec/helpers/listing_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ListingHelper, type: :helper do +RSpec.describe ListingHelper do let!(:cat1) { create(:listing_category, cost: 1) } let!(:cat2) { create(:listing_category, :cfp, cost: 5) } diff --git a/spec/helpers/organization_helper_spec.rb b/spec/helpers/organization_helper_spec.rb index 62b337386..6defde440 100644 --- a/spec/helpers/organization_helper_spec.rb +++ b/spec/helpers/organization_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe OrganizationHelper, type: :helper do +describe OrganizationHelper do it "displays the correct options" do org1 = create(:organization, name: "ACME") org2 = create(:organization, name: "Pied Piper") diff --git a/spec/helpers/rate_limit_checker_helper_spec.rb b/spec/helpers/rate_limit_checker_helper_spec.rb index 13a48c67b..4bb1cc18d 100644 --- a/spec/helpers/rate_limit_checker_helper_spec.rb +++ b/spec/helpers/rate_limit_checker_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe RateLimitCheckerHelper, type: :helper do +describe RateLimitCheckerHelper do describe "#configurable_rate_limits" do it "returns a hash with the right structure" do settings_keys = Settings::RateLimit.keys.map(&:to_sym) diff --git a/spec/lib/data_update_scripts/rename_moderator_to_super_moderator_spec.rb b/spec/lib/data_update_scripts/rename_moderator_to_super_moderator_spec.rb index 9231c677a..b3fed6199 100644 --- a/spec/lib/data_update_scripts/rename_moderator_to_super_moderator_spec.rb +++ b/spec/lib/data_update_scripts/rename_moderator_to_super_moderator_spec.rb @@ -5,9 +5,9 @@ require Rails.root.join( describe DataUpdateScripts::RenameModeratorToSuperModerator do before do - create :user - create :user, :tag_moderator - create :user, :super_admin + create(:user) + create(:user, :tag_moderator) + create(:user, :super_admin) end context "when there are no moderators" do @@ -36,7 +36,7 @@ describe DataUpdateScripts::RenameModeratorToSuperModerator do end context "when rename has already run" do - let!(:super_moderator) { create :user, :super_moderator } + let!(:super_moderator) { create(:user, :super_moderator) } it "does nothing" do expect(described_class.new.run).to eq(0) diff --git a/spec/mailers/application_mailer_spec.rb b/spec/mailers/application_mailer_spec.rb index d383e1a59..d5a83392f 100644 --- a/spec/mailers/application_mailer_spec.rb +++ b/spec/mailers/application_mailer_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ApplicationMailer, type: :mailer do +RSpec.describe ApplicationMailer do let(:user) { create(:user) } let(:email) { VerificationMailer.with(user_id: user.id).account_ownership_verification_email } diff --git a/spec/mailers/devise_mailer_spec.rb b/spec/mailers/devise_mailer_spec.rb index 652bba5ad..f78f64c5c 100644 --- a/spec/mailers/devise_mailer_spec.rb +++ b/spec/mailers/devise_mailer_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe DeviseMailer, type: :mailer do +RSpec.describe DeviseMailer do let(:user) { create(:user) } describe "#reset_password_instructions" do diff --git a/spec/mailers/digest_mailer_spec.rb b/spec/mailers/digest_mailer_spec.rb index f7b0b1e40..c99e69c89 100644 --- a/spec/mailers/digest_mailer_spec.rb +++ b/spec/mailers/digest_mailer_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe DigestMailer, type: :mailer do +RSpec.describe DigestMailer do let(:user) { create(:user) } let(:article) { build_stubbed(:article) } let(:from_email_address) { "custom_noreply@forem.com" } diff --git a/spec/mailers/notify_mailer_spec.rb b/spec/mailers/notify_mailer_spec.rb index 382facc86..400ffe96e 100644 --- a/spec/mailers/notify_mailer_spec.rb +++ b/spec/mailers/notify_mailer_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe NotifyMailer, type: :mailer do +RSpec.describe NotifyMailer do let(:user) { create(:user) } let(:user2) { create(:user) } let(:article) { create(:article, user_id: user.id) } diff --git a/spec/mailers/verification_mailer_spec.rb b/spec/mailers/verification_mailer_spec.rb index dfe2ea23a..743c74a93 100644 --- a/spec/mailers/verification_mailer_spec.rb +++ b/spec/mailers/verification_mailer_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe VerificationMailer, type: :mailer do +RSpec.describe VerificationMailer do let(:user) { create(:user) } let(:from_email_address) { "custom_noreply@forem.com" } diff --git a/spec/models/ahoy/visit_spec.rb b/spec/models/ahoy/visit_spec.rb index 08ce4043c..1ab259af5 100644 --- a/spec/models/ahoy/visit_spec.rb +++ b/spec/models/ahoy/visit_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Ahoy::Visit, type: :model do +RSpec.describe Ahoy::Visit do let(:visit) { create(:ahoy_visit) } describe "validations" do diff --git a/spec/models/api_secret_spec.rb b/spec/models/api_secret_spec.rb index 9ea185eff..643d0359d 100644 --- a/spec/models/api_secret_spec.rb +++ b/spec/models/api_secret_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ApiSecret, type: :model do +RSpec.describe ApiSecret do describe "validations" do subject { create(:api_secret) } diff --git a/spec/models/application_record_spec.rb b/spec/models/application_record_spec.rb index 1fa308dba..df4c5d675 100644 --- a/spec/models/application_record_spec.rb +++ b/spec/models/application_record_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" # ApplicationRecord is an abstract class, tests will use one of the core models -RSpec.describe ApplicationRecord, type: :model do +RSpec.describe ApplicationRecord do describe ".estimated_count" do it "does not raise errors if there are no rows" do expect { User.estimated_count }.not_to raise_error diff --git a/spec/models/article_destroy_spec.rb b/spec/models/article_destroy_spec.rb index 5acc5e768..ae16ed8bf 100644 --- a/spec/models/article_destroy_spec.rb +++ b/spec/models/article_destroy_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Article, type: :model do +RSpec.describe Article do context "when no organization" do # Setting published explicitly to true to pass guard clause in the async_score_calc method on # the Article model that returns early if the article is unpublished diff --git a/spec/models/articles/cached_entity_spec.rb b/spec/models/articles/cached_entity_spec.rb index a502cb1dd..3a9cd56e0 100644 --- a/spec/models/articles/cached_entity_spec.rb +++ b/spec/models/articles/cached_entity_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Articles::CachedEntity, type: :model do +RSpec.describe Articles::CachedEntity do subject(:struct) { described_class.from_object(object) } let(:object) { build(:user) } diff --git a/spec/models/audit_log_spec.rb b/spec/models/audit_log_spec.rb index bc0a1116a..c7978f83a 100644 --- a/spec/models/audit_log_spec.rb +++ b/spec/models/audit_log_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe AuditLog, type: :model do +RSpec.describe AuditLog do let(:audit_log) { create(:audit_log) } describe "validations" do diff --git a/spec/models/badge_achievement_spec.rb b/spec/models/badge_achievement_spec.rb index 9abbb886d..896b68c49 100644 --- a/spec/models/badge_achievement_spec.rb +++ b/spec/models/badge_achievement_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe BadgeAchievement, type: :model do +RSpec.describe BadgeAchievement do let(:badge_with_credits) { create(:badge, credits_awarded: 10) } let(:badge) { create(:badge, credits_awarded: 0) } let(:achievement) { create(:badge_achievement, badge: badge) } diff --git a/spec/models/badge_spec.rb b/spec/models/badge_spec.rb index 1955644dc..1653a0c68 100644 --- a/spec/models/badge_spec.rb +++ b/spec/models/badge_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Badge, type: :model do +RSpec.describe Badge do let(:badge) { create(:badge) } let(:cache_bust) { instance_double(EdgeCache::Bust) } diff --git a/spec/models/banished_user_spec.rb b/spec/models/banished_user_spec.rb index bd43be2c6..7beb371e8 100644 --- a/spec/models/banished_user_spec.rb +++ b/spec/models/banished_user_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe BanishedUser, type: :model do +RSpec.describe BanishedUser do describe "validations" do describe "builtin validations" do it { is_expected.to belong_to(:banished_by).class_name("User").optional } diff --git a/spec/models/broadcast_spec.rb b/spec/models/broadcast_spec.rb index 6cb37ac2d..4d4f42054 100644 --- a/spec/models/broadcast_spec.rb +++ b/spec/models/broadcast_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Broadcast, type: :model do +RSpec.describe Broadcast do it { is_expected.to validate_presence_of(:title) } it { is_expected.to validate_presence_of(:type_of) } it { is_expected.to validate_presence_of(:processed_html) } diff --git a/spec/models/collection_spec.rb b/spec/models/collection_spec.rb index 7f04348a8..c762d3e51 100644 --- a/spec/models/collection_spec.rb +++ b/spec/models/collection_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Collection, type: :model do +RSpec.describe Collection do let(:user) { create(:user) } let(:collection) { create(:collection, :with_articles, user: user) } diff --git a/spec/models/consumer_app_spec.rb b/spec/models/consumer_app_spec.rb index 55a2deabc..9516efc56 100644 --- a/spec/models/consumer_app_spec.rb +++ b/spec/models/consumer_app_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ConsumerApp, type: :model do +RSpec.describe ConsumerApp do let(:consumer_app_android) { create(:consumer_app, platform: :android) } let(:consumer_app_ios) { create(:consumer_app, platform: :ios) } diff --git a/spec/models/context_notification_spec.rb b/spec/models/context_notification_spec.rb index 3745d7caf..132d5ce3c 100644 --- a/spec/models/context_notification_spec.rb +++ b/spec/models/context_notification_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ContextNotification, type: :model do +RSpec.describe ContextNotification do let(:context_notification) { create(:context_notification) } describe "validations" do diff --git a/spec/models/credit_spec.rb b/spec/models/credit_spec.rb index 080c36ead..671ebbd00 100644 --- a/spec/models/credit_spec.rb +++ b/spec/models/credit_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Credit, type: :model do +RSpec.describe Credit do let(:user) { create(:user) } let(:organization) { create(:organization) } diff --git a/spec/models/device_spec.rb b/spec/models/device_spec.rb index 27b4bfc64..a8138c037 100644 --- a/spec/models/device_spec.rb +++ b/spec/models/device_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Device, type: :model do +RSpec.describe Device do let(:device) { create(:device) } let(:user) { create(:user) } diff --git a/spec/models/discussion_lock_spec.rb b/spec/models/discussion_lock_spec.rb index 71fe1a264..bd634ec0f 100644 --- a/spec/models/discussion_lock_spec.rb +++ b/spec/models/discussion_lock_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe DiscussionLock, type: :model do +RSpec.describe DiscussionLock do let(:discussion_lock) { create(:discussion_lock) } describe "relationships" do diff --git a/spec/models/display_ad_event_spec.rb b/spec/models/display_ad_event_spec.rb index 5ab0b41ae..7dafb13c7 100644 --- a/spec/models/display_ad_event_spec.rb +++ b/spec/models/display_ad_event_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe DisplayAdEvent, type: :model do +RSpec.describe DisplayAdEvent do it { is_expected.to validate_inclusion_of(:category).in_array(described_class::VALID_CATEGORIES) } it { is_expected.to validate_inclusion_of(:context_type).in_array(described_class::VALID_CONTEXT_TYPES) } diff --git a/spec/models/email_authorization_spec.rb b/spec/models/email_authorization_spec.rb index 10a4834b9..c67aa41f8 100644 --- a/spec/models/email_authorization_spec.rb +++ b/spec/models/email_authorization_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe EmailAuthorization, type: :model do +RSpec.describe EmailAuthorization do let(:email_authorization) { create(:email_authorization) } describe "validations" do diff --git a/spec/models/email_message_spec.rb b/spec/models/email_message_spec.rb index d8f38902b..7326aad17 100644 --- a/spec/models/email_message_spec.rb +++ b/spec/models/email_message_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe EmailMessage, type: :model do +RSpec.describe EmailMessage do describe "validations" do subject { create(:email_message) } diff --git a/spec/models/feedback_message_spec.rb b/spec/models/feedback_message_spec.rb index d410302e8..9cee120d7 100644 --- a/spec/models/feedback_message_spec.rb +++ b/spec/models/feedback_message_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe FeedbackMessage, type: :model do +RSpec.describe FeedbackMessage do let(:reporter) { create(:user) } let(:abuse_report) { create(:feedback_message, :abuse_report, reporter: reporter) } diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index 2b70f56cf..edb4fedf4 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Follow, type: :model do +RSpec.describe Follow do let(:user) { create(:user) } let(:tag) { create(:tag) } let(:user_2) { create(:user) } diff --git a/spec/models/forem_instance_spec.rb b/spec/models/forem_instance_spec.rb index bcb7ca55f..bb5b3d090 100644 --- a/spec/models/forem_instance_spec.rb +++ b/spec/models/forem_instance_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ForemInstance, type: :model do +RSpec.describe ForemInstance do describe "deployed_at" do before do allow(ENV).to receive(:[]) diff --git a/spec/models/github_issue_spec.rb b/spec/models/github_issue_spec.rb index e522fbb5b..d55788143 100644 --- a/spec/models/github_issue_spec.rb +++ b/spec/models/github_issue_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe GithubIssue, type: :model, vcr: true do +RSpec.describe GithubIssue, vcr: true do let(:url_issue) { "https://api.github.com/repos/forem/forem/issues/7434" } let(:url_pull_request) { "https://api.github.com/repos/forem/forem/pulls/7653" } let(:url_comment) { "https://api.github.com/repos/forem/forem/issues/comments/621043602" } diff --git a/spec/models/github_repo_spec.rb b/spec/models/github_repo_spec.rb index d94d2cb37..0fff43dc4 100644 --- a/spec/models/github_repo_spec.rb +++ b/spec/models/github_repo_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe GithubRepo, type: :model do +RSpec.describe GithubRepo do let(:user) { create(:user, :with_identity, identities: ["github"]) } let(:repo) { create(:github_repo, user: user) } let(:cache_bust) { instance_double(EdgeCache::Bust) } diff --git a/spec/models/html_variant_spec.rb b/spec/models/html_variant_spec.rb index a26acae7a..b70ec9eeb 100644 --- a/spec/models/html_variant_spec.rb +++ b/spec/models/html_variant_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe HtmlVariant, type: :model do +RSpec.describe HtmlVariant do let(:html_variant) { create(:html_variant, approved: true, published: true) } describe "validations" do diff --git a/spec/models/identity_spec.rb b/spec/models/identity_spec.rb index 8eb46ba29..ba50bffab 100644 --- a/spec/models/identity_spec.rb +++ b/spec/models/identity_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Identity, type: :model do +RSpec.describe Identity do let(:identity) { create(:identity, user: create(:user), uid: SecureRandom.hex) } describe "validations" do diff --git a/spec/models/listing_category_spec.rb b/spec/models/listing_category_spec.rb index 8ce16a7ea..6a6fad08b 100644 --- a/spec/models/listing_category_spec.rb +++ b/spec/models/listing_category_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ListingCategory, type: :model do +RSpec.describe ListingCategory do describe "validations" do # The uniqueness validation didn't work without this, see section "Caveat" at # https://www.rubydoc.info/github/thoughtbot/shoulda-matchers/Shoulda%2FMatchers%2FActiveRecord:validate_uniqueness_of diff --git a/spec/models/listing_spec.rb b/spec/models/listing_spec.rb index 81f996912..a04d01050 100644 --- a/spec/models/listing_spec.rb +++ b/spec/models/listing_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Listing, type: :model do +RSpec.describe Listing do let(:user) { create(:user) } let(:organization) { create(:organization) } let(:listing) { create(:listing, user: user) } diff --git a/spec/models/mention_spec.rb b/spec/models/mention_spec.rb index d0fbd13b9..dc9c15866 100644 --- a/spec/models/mention_spec.rb +++ b/spec/models/mention_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Mention, type: :model do +RSpec.describe Mention do let(:comment) { create(:comment, commentable: create(:podcast_episode)) } describe "#create_all" do diff --git a/spec/models/navigation_link_spec.rb b/spec/models/navigation_link_spec.rb index 89bc67d99..356c32db5 100644 --- a/spec/models/navigation_link_spec.rb +++ b/spec/models/navigation_link_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe NavigationLink, type: :model do +RSpec.describe NavigationLink do let(:navigation_link) { create(:navigation_link) } describe ".create_or_update_by_identity" do diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index fd3922cfd..dcb60e895 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Note, type: :model do +RSpec.describe Note do it { is_expected.to belong_to(:noteable) } it { is_expected.to belong_to(:author).class_name("User").optional } diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index 880d7d749..305bb9fd9 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" require "sidekiq/testing" -RSpec.describe Notification, type: :model do +RSpec.describe Notification do let(:user) { create(:user) } let(:user2) { create(:user) } let(:user3) { create(:user) } diff --git a/spec/models/notification_subscription_spec.rb b/spec/models/notification_subscription_spec.rb index 63afbadca..f13107e73 100644 --- a/spec/models/notification_subscription_spec.rb +++ b/spec/models/notification_subscription_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe NotificationSubscription, type: :model do +RSpec.describe NotificationSubscription do let(:user) { create(:user) } let(:article) { create(:article, user: user) } let(:notification_subscription) { create(:notification_subscription, user: user, notifiable: article) } diff --git a/spec/models/organization_membership_spec.rb b/spec/models/organization_membership_spec.rb index 7c7bae1f9..9de5e94b2 100644 --- a/spec/models/organization_membership_spec.rb +++ b/spec/models/organization_membership_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe OrganizationMembership, type: :model do +RSpec.describe OrganizationMembership do describe "validations" do subject { build(:organization_membership) } diff --git a/spec/models/page_spec.rb b/spec/models/page_spec.rb index a63cc7606..9e48ef7ab 100644 --- a/spec/models/page_spec.rb +++ b/spec/models/page_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Page, type: :model do +RSpec.describe Page do describe ".render_safe_html_for" do let(:slug) { "the-given-slug" } diff --git a/spec/models/page_view_spec.rb b/spec/models/page_view_spec.rb index 28cebadc9..b88788b1e 100644 --- a/spec/models/page_view_spec.rb +++ b/spec/models/page_view_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe PageView, type: :model do +RSpec.describe PageView do let(:page_view) { create(:page_view, referrer: "http://example.com/page") } it { is_expected.to belong_to(:user).optional } diff --git a/spec/models/pinned_article_spec.rb b/spec/models/pinned_article_spec.rb index d361596d0..f872a3f17 100644 --- a/spec/models/pinned_article_spec.rb +++ b/spec/models/pinned_article_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe PinnedArticle, type: :model do +RSpec.describe PinnedArticle do let(:article) { create(:article) } describe ".exists?" do diff --git a/spec/models/podcast_episode_appearance_spec.rb b/spec/models/podcast_episode_appearance_spec.rb index a1d50b4f7..d2208635c 100644 --- a/spec/models/podcast_episode_appearance_spec.rb +++ b/spec/models/podcast_episode_appearance_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe PodcastEpisodeAppearance, type: :model do +RSpec.describe PodcastEpisodeAppearance do let(:podcast_episode_appearance) { create(:podcast_episode_appearance) } describe "validations" do diff --git a/spec/models/podcast_episode_spec.rb b/spec/models/podcast_episode_spec.rb index 176f64ef2..a987520f1 100644 --- a/spec/models/podcast_episode_spec.rb +++ b/spec/models/podcast_episode_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe PodcastEpisode, type: :model do +RSpec.describe PodcastEpisode do let(:podcast_episode) { create(:podcast_episode) } describe "validations" do diff --git a/spec/models/podcast_ownership_spec.rb b/spec/models/podcast_ownership_spec.rb index d01f560b9..1143bc0f4 100644 --- a/spec/models/podcast_ownership_spec.rb +++ b/spec/models/podcast_ownership_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe PodcastOwnership, type: :model do +RSpec.describe PodcastOwnership do let(:podcast_ownership) { create(:podcast_ownership) } describe "validations" do diff --git a/spec/models/podcast_spec.rb b/spec/models/podcast_spec.rb index c127d340e..3430c3a23 100644 --- a/spec/models/podcast_spec.rb +++ b/spec/models/podcast_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Podcast, type: :model do +RSpec.describe Podcast do let(:podcast) { create(:podcast) } it "has a creator" do diff --git a/spec/models/poll_option_spec.rb b/spec/models/poll_option_spec.rb index f02de4fea..b6e5ee66b 100644 --- a/spec/models/poll_option_spec.rb +++ b/spec/models/poll_option_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe PollOption, type: :model do +RSpec.describe PollOption do let(:article) { build(:article, featured: true) } let(:poll) { build(:poll, article: article) } let(:poll_option) { build(:poll_option, poll: poll) } diff --git a/spec/models/poll_skip_spec.rb b/spec/models/poll_skip_spec.rb index 01dce6a56..aa63769ea 100644 --- a/spec/models/poll_skip_spec.rb +++ b/spec/models/poll_skip_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe PollSkip, type: :model do +RSpec.describe PollSkip do let(:article) { create(:article, featured: true) } let(:user) { create(:user) } let(:poll) { create(:poll, article: article) } diff --git a/spec/models/poll_spec.rb b/spec/models/poll_spec.rb index dfb3aa472..84d6a2f83 100644 --- a/spec/models/poll_spec.rb +++ b/spec/models/poll_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Poll, type: :model do +RSpec.describe Poll do let(:article) { create(:article, featured: true) } describe "validations" do diff --git a/spec/models/poll_vote_spec.rb b/spec/models/poll_vote_spec.rb index 6cc7c83a2..74df60383 100644 --- a/spec/models/poll_vote_spec.rb +++ b/spec/models/poll_vote_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe PollVote, type: :model do +RSpec.describe PollVote do let(:article) { create(:article, featured: true) } let(:user) { create(:user) } let(:poll) { create(:poll, article_id: article.id) } diff --git a/spec/models/profile_field_group_spec.rb b/spec/models/profile_field_group_spec.rb index 647103664..7f96fb2dd 100644 --- a/spec/models/profile_field_group_spec.rb +++ b/spec/models/profile_field_group_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ProfileFieldGroup, type: :model do +RSpec.describe ProfileFieldGroup do subject { group } let!(:group) { create(:profile_field_group) } diff --git a/spec/models/profile_field_spec.rb b/spec/models/profile_field_spec.rb index f8bca81e6..c4e7db0d0 100644 --- a/spec/models/profile_field_spec.rb +++ b/spec/models/profile_field_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ProfileField, type: :model do +RSpec.describe ProfileField do describe "associations" do it { is_expected.to belong_to(:profile_field_group) } end diff --git a/spec/models/profile_pin_spec.rb b/spec/models/profile_pin_spec.rb index b900310f1..e1e57dee8 100644 --- a/spec/models/profile_pin_spec.rb +++ b/spec/models/profile_pin_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ProfilePin, type: :model do +RSpec.describe ProfilePin do let(:user) { create(:user) } describe "validations" do diff --git a/spec/models/profile_spec.rb b/spec/models/profile_spec.rb index 2fbd4fc31..d226958e0 100644 --- a/spec/models/profile_spec.rb +++ b/spec/models/profile_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Profile, type: :model do +RSpec.describe Profile do let(:user) { create(:user) } let(:profile) { user.profile } diff --git a/spec/models/rating_vote_spec.rb b/spec/models/rating_vote_spec.rb index a5d520fa5..2ab897ad2 100644 --- a/spec/models/rating_vote_spec.rb +++ b/spec/models/rating_vote_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe RatingVote, type: :model do +RSpec.describe RatingVote do let(:user) { create(:user, :trusted) } let(:user2) { create(:user, :trusted) } let(:article) { create(:article, user: user) } diff --git a/spec/models/response_template_spec.rb b/spec/models/response_template_spec.rb index 5fbc5d0ea..43c05a236 100644 --- a/spec/models/response_template_spec.rb +++ b/spec/models/response_template_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe ResponseTemplate, type: :model do +RSpec.describe ResponseTemplate do let(:comment_validation_message) { I18n.t("models.response_template.comment_markdown") } it { is_expected.to validate_inclusion_of(:type_of).in_array(ResponseTemplate::TYPE_OF_TYPES) } diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb index 62ceed765..f3dc0a51d 100644 --- a/spec/models/role_spec.rb +++ b/spec/models/role_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Role, type: :model do +RSpec.describe Role do it { is_expected.to belong_to(:resource).optional } it { is_expected.to validate_inclusion_of(:resource_type).in_array(Rolify.resource_types) } it { is_expected.to validate_inclusion_of(:name).in_array(described_class::ROLES) } diff --git a/spec/models/settings/authentication_spec.rb b/spec/models/settings/authentication_spec.rb index c79716404..593d7c770 100644 --- a/spec/models/settings/authentication_spec.rb +++ b/spec/models/settings/authentication_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Settings::Authentication, type: :model do +RSpec.describe Settings::Authentication do describe "#acceptable_domain?" do subject { described_class.acceptable_domain?(domain: domain) } diff --git a/spec/models/settings/base_spec.rb b/spec/models/settings/base_spec.rb index 0d7174194..ca56bfc9a 100644 --- a/spec/models/settings/base_spec.rb +++ b/spec/models/settings/base_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Settings::Base, type: :model do +RSpec.describe Settings::Base do with_model :TestSetting, superclass: described_class do table do |t| t.string :var, null: false diff --git a/spec/models/settings/general_spec.rb b/spec/models/settings/general_spec.rb index 1183f4c6e..c9fef1ad6 100644 --- a/spec/models/settings/general_spec.rb +++ b/spec/models/settings/general_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Settings::General, type: :model do +RSpec.describe Settings::General do describe "validations" do describe "validating URLs" do let(:url_fields) do diff --git a/spec/models/settings/rate_limit_spec.rb b/spec/models/settings/rate_limit_spec.rb index 329b951b0..459011c87 100644 --- a/spec/models/settings/rate_limit_spec.rb +++ b/spec/models/settings/rate_limit_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Settings::RateLimit, type: :model do +RSpec.describe Settings::RateLimit do describe ".user_considered_new?" do subject(:function_call) { described_class.user_considered_new?(user: user) } diff --git a/spec/models/tag_adjustment_spec.rb b/spec/models/tag_adjustment_spec.rb index b1796f8a3..d0308e78b 100644 --- a/spec/models/tag_adjustment_spec.rb +++ b/spec/models/tag_adjustment_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe TagAdjustment, type: :model do +RSpec.describe TagAdjustment do before do mod_user.add_role(:tag_moderator, tag) admin_user.add_role(:admin) diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 3235e2901..903832b0a 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Tag, type: :model do +RSpec.describe Tag do let(:tag) { build(:tag) } describe "#class_name" do diff --git a/spec/models/timeframe_spec.rb b/spec/models/timeframe_spec.rb index 8d83d97d3..2224ac3a7 100644 --- a/spec/models/timeframe_spec.rb +++ b/spec/models/timeframe_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Timeframe, type: :model do +RSpec.describe Timeframe do it "sets timeframe for week to 1 week ago" do Timecop.freeze(Time.current) do timeframe = described_class.datetime("week") diff --git a/spec/models/tweet_spec.rb b/spec/models/tweet_spec.rb index 924029534..3a6789340 100644 --- a/spec/models/tweet_spec.rb +++ b/spec/models/tweet_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Tweet, type: :model, vcr: true do +RSpec.describe Tweet, vcr: true do let(:tweet_id) { "1018911886862057472" } let(:tweet_reply_id) { "1242938461784608770" } let(:retweet_id) { "1262395854469677058" } diff --git a/spec/models/user_block_spec.rb b/spec/models/user_block_spec.rb index ebdde52f9..bce14653e 100644 --- a/spec/models/user_block_spec.rb +++ b/spec/models/user_block_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe UserBlock, type: :model do +RSpec.describe UserBlock do let(:blocker) { create(:user) } let(:blocked_user) { create(:user) } diff --git a/spec/models/user_role_spec.rb b/spec/models/user_role_spec.rb index 7dd097666..ed1170a3a 100644 --- a/spec/models/user_role_spec.rb +++ b/spec/models/user_role_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe UserRole, type: :model do +RSpec.describe UserRole do it { is_expected.to belong_to(:user) } it { is_expected.to belong_to(:role) } end diff --git a/spec/models/users/deleted_user_spec.rb b/spec/models/users/deleted_user_spec.rb index bcadcb802..cbcbc2175 100644 --- a/spec/models/users/deleted_user_spec.rb +++ b/spec/models/users/deleted_user_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Users::DeletedUser, type: :model do +RSpec.describe Users::DeletedUser do subject(:deleted_user) { described_class } describe "#class_name" do diff --git a/spec/models/users/notification_setting_spec.rb b/spec/models/users/notification_setting_spec.rb index 4e354e8f7..9864ad9f7 100644 --- a/spec/models/users/notification_setting_spec.rb +++ b/spec/models/users/notification_setting_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Users::NotificationSetting, type: :model do +RSpec.describe Users::NotificationSetting do let!(:user) { create(:user) } let(:notification_setting) { user.notification_setting.reload } diff --git a/spec/models/users/setting_spec.rb b/spec/models/users/setting_spec.rb index d5e16e651..37955157c 100644 --- a/spec/models/users/setting_spec.rb +++ b/spec/models/users/setting_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" # rubocop:disable Layout/LineLength -RSpec.describe Users::Setting, type: :model do +RSpec.describe Users::Setting do let(:user) { create(:user) } let(:setting) { described_class.find_by(user_id: user.id) } diff --git a/spec/models/users/suspended_username_spec.rb b/spec/models/users/suspended_username_spec.rb index 580c1831d..2c9dedde7 100644 --- a/spec/models/users/suspended_username_spec.rb +++ b/spec/models/users/suspended_username_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Users::SuspendedUsername, type: :model do +RSpec.describe Users::SuspendedUsername do describe "validations" do subject { create(:suspended_username) } diff --git a/spec/queries/admin/users_query_spec.rb b/spec/queries/admin/users_query_spec.rb index 3d2d5fa2f..f1aeb2b9e 100644 --- a/spec/queries/admin/users_query_spec.rb +++ b/spec/queries/admin/users_query_spec.rb @@ -10,8 +10,8 @@ RSpec.describe Admin::UsersQuery, type: :query do let(:joining_end) { nil } describe ".find" do - let!(:user1) { create :user, username: "user1" } - let!(:user2) { create :user, username: "user12" } + let!(:user1) { create(:user, username: "user1") } + let!(:user2) { create(:user, username: "user12") } context "when identifier is blank" do it "returns nil" do diff --git a/spec/queries/comments/community_wellness_query_spec.rb b/spec/queries/comments/community_wellness_query_spec.rb index 8f9960fed..3d0ab4c9e 100644 --- a/spec/queries/comments/community_wellness_query_spec.rb +++ b/spec/queries/comments/community_wellness_query_spec.rb @@ -70,7 +70,7 @@ RSpec.describe Comments::CommunityWellnessQuery, type: :query do it "returns users with correct data on their corresponding hash" do result = described_class.call - result_user_ids = result.map { |hash| hash["user_id"] } + result_user_ids = result.pluck("user_id") expect(result_user_ids).to contain_exactly(user1.id, user2.id, user5.id) index1 = result.index { |hash| hash["user_id"] == user1.id } @@ -119,7 +119,7 @@ RSpec.describe Comments::CommunityWellnessQuery, type: :query do it "matches the correct comment count for each week in result hash" do result = described_class.call - result_user_ids = result.map { |hash| hash["user_id"] } + result_user_ids = result.pluck("user_id") # Result includes both users because they have > 1 comment per week expect(result_user_ids).to contain_exactly(user1.id, user2.id) diff --git a/spec/requests/admin/reactions_spec.rb b/spec/requests/admin/reactions_spec.rb index 92f201bf8..0b52c3963 100644 --- a/spec/requests/admin/reactions_spec.rb +++ b/spec/requests/admin/reactions_spec.rb @@ -44,12 +44,12 @@ RSpec.describe "/admin/reactions" do it "returns expected JSON upon status update" do put admin_reaction_path(reaction.id), params: { id: reaction.id, status: "confirmed" } - expect(JSON.parse(response.body)).to eq("outcome" => "Success") + expect(response.parsed_body).to eq("outcome" => "Success") end it "returns error upon status update failure" do put admin_reaction_path(reaction.id), params: { id: reaction.id, status: "confirmedsssss" } - expect(JSON.parse(response.body)).to include("error") + expect(response.parsed_body).to include("error") end end diff --git a/spec/requests/api/v0/analytics_spec.rb b/spec/requests/api/v0/analytics_spec.rb index cf6673a95..932b3d6d0 100644 --- a/spec/requests/api/v0/analytics_spec.rb +++ b/spec/requests/api/v0/analytics_spec.rb @@ -17,7 +17,7 @@ RSpec.describe "Api::V0::Analytics" do it "renders the proper error message in JSON" do error_message = "Required 'start' parameter is missing" - expect(JSON.parse(response.body)["error"]).to eq(error_message) + expect(response.parsed_body["error"]).to eq(error_message) end end @@ -30,7 +30,7 @@ RSpec.describe "Api::V0::Analytics" do it "renders the proper error message in JSON" do error_message = "Date parameters 'start' or 'end' must be in the format of 'yyyy-mm-dd'" - expect(JSON.parse(response.body)["error"]).to eq(error_message) + expect(response.parsed_body["error"]).to eq(error_message) end end end diff --git a/spec/requests/api/v0/feature_flags_spec.rb b/spec/requests/api/v0/feature_flags_spec.rb index 1893c7ed1..86826ba4a 100644 --- a/spec/requests/api/v0/feature_flags_spec.rb +++ b/spec/requests/api/v0/feature_flags_spec.rb @@ -57,7 +57,7 @@ RSpec.describe "Api::V0::FeatureFlagsController" do get api_feature_flags_path(flag: flag) - parsed_response = JSON.parse(response.body) + parsed_response = response.parsed_body expect(parsed_response[flag]).to be true end end diff --git a/spec/requests/api/v1/analytics_spec.rb b/spec/requests/api/v1/analytics_spec.rb index e03dd8c58..10dbe5bb8 100644 --- a/spec/requests/api/v1/analytics_spec.rb +++ b/spec/requests/api/v1/analytics_spec.rb @@ -25,7 +25,7 @@ RSpec.describe "Api::V1::Analytics" do it "renders the proper error message in JSON" do error_message = "Required 'start' parameter is missing" - expect(JSON.parse(response.body)["error"]).to eq(error_message) + expect(response.parsed_body["error"]).to eq(error_message) end end @@ -38,7 +38,7 @@ RSpec.describe "Api::V1::Analytics" do it "renders the proper error message in JSON" do error_message = "Date parameters 'start' or 'end' must be in the format of 'yyyy-mm-dd'" - expect(JSON.parse(response.body)["error"]).to eq(error_message) + expect(response.parsed_body["error"]).to eq(error_message) end end end diff --git a/spec/requests/api/v1/feature_flags_spec.rb b/spec/requests/api/v1/feature_flags_spec.rb index 6fcee78c2..ce44849b9 100644 --- a/spec/requests/api/v1/feature_flags_spec.rb +++ b/spec/requests/api/v1/feature_flags_spec.rb @@ -58,7 +58,7 @@ RSpec.describe "Api::V1::FeatureFlagsController" do get api_feature_flags_path(flag: flag), headers: headers - parsed_response = JSON.parse(response.body) + parsed_response = response.parsed_body expect(parsed_response[flag]).to be true end end diff --git a/spec/requests/api/v1/reactions_spec.rb b/spec/requests/api/v1/reactions_spec.rb index 8edde44b3..246109d20 100644 --- a/spec/requests/api/v1/reactions_spec.rb +++ b/spec/requests/api/v1/reactions_spec.rb @@ -50,8 +50,8 @@ RSpec.describe "Api::V1::Reactions" do it "responds with expected JSON" do post api_reactions_toggle_path, params: params.to_json, headers: auth_header - expect(JSON.parse(response.body).keys).to contain_exactly("id", "result", "category", "reactable_type", - "reactable_id") + expect(response.parsed_body.keys).to contain_exactly("id", "result", "category", "reactable_type", + "reactable_id") end end @@ -103,8 +103,8 @@ RSpec.describe "Api::V1::Reactions" do it "responds with expected JSON" do post api_reactions_path, params: params.to_json, headers: auth_header - expect(JSON.parse(response.body).keys).to contain_exactly("id", "result", "category", "reactable_type", - "reactable_id") + expect(response.parsed_body.keys).to contain_exactly("id", "result", "category", "reactable_type", + "reactable_id") end end diff --git a/spec/requests/follows_create_spec.rb b/spec/requests/follows_create_spec.rb index ca4d68301..0891dd0a4 100644 --- a/spec/requests/follows_create_spec.rb +++ b/spec/requests/follows_create_spec.rb @@ -32,7 +32,7 @@ RSpec.describe "Follows #create" do it "returns an error for too many follows in a day" do post "/follows", headers: headers, params: follow_payload - json_response = JSON.parse(response.body) + json_response = response.parsed_body expect(response).to have_http_status(:too_many_requests) expect(json_response["error"]).to eq("Daily account follow limit reached!") @@ -43,7 +43,7 @@ RSpec.describe "Follows #create" do post "/follows", headers: headers, params: follow_payload expect(response).to have_http_status(:ok) - expect(JSON.parse(response.body)["outcome"]).to eq("followed") + expect(response.parsed_body["outcome"]).to eq("followed") end it "unfollows" do @@ -52,6 +52,6 @@ RSpec.describe "Follows #create" do params: { followable_type: "User", followable_id: user.id, verb: "unfollow" }.to_json expect(response).to have_http_status(:ok) - expect(JSON.parse(response.body)["outcome"]).to eq("unfollowed") + expect(response.parsed_body["outcome"]).to eq("unfollowed") end end diff --git a/spec/requests/notification_subscriptions_spec.rb b/spec/requests/notification_subscriptions_spec.rb index 980e60ee0..ede3b7640 100644 --- a/spec/requests/notification_subscriptions_spec.rb +++ b/spec/requests/notification_subscriptions_spec.rb @@ -48,14 +48,14 @@ RSpec.describe "NotificationSubscriptions" do it "returns the correct subscription boolean as JSON" do get "/notification_subscriptions/Article/#{article.id}", headers: headers - expect(JSON.parse(response.body)["config"]).to eq "all_comments" + expect(response.parsed_body["config"]).to eq "all_comments" end it "returns the correct subscription boolean as JSON if unsubscribed" do article.notification_subscriptions.first.delete get "/notification_subscriptions/Article/#{article.id}", headers: headers - expect(JSON.parse(response.body)["config"]).to eq "not_subscribed" + expect(response.parsed_body["config"]).to eq "not_subscribed" end end diff --git a/spec/requests/poll_votes_spec.rb b/spec/requests/poll_votes_spec.rb index b13b66108..10d7a9130 100644 --- a/spec/requests/poll_votes_spec.rb +++ b/spec/requests/poll_votes_spec.rb @@ -10,19 +10,19 @@ RSpec.describe "PollVotes" do describe "GET /poll_votes" do it "returns proper results for poll" do get "/poll_votes/#{poll.id}" - expect(JSON.parse(response.body)["voting_data"]["votes_count"]).to eq(0) - expect(JSON.parse(response.body)["voting_data"]["votes_distribution"]).to include([poll.poll_options.first.id, 0]) - expect(JSON.parse(response.body)["poll_id"]).to eq(poll.id) - expect(JSON.parse(response.body)["voted"]).to be(false) + expect(response.parsed_body["voting_data"]["votes_count"]).to eq(0) + expect(response.parsed_body["voting_data"]["votes_distribution"]).to include([poll.poll_options.first.id, 0]) + expect(response.parsed_body["poll_id"]).to eq(poll.id) + expect(response.parsed_body["voted"]).to be(false) end it "returns proper results for poll if voted" do create(:poll_vote, user_id: user.id, poll_option_id: poll.poll_options.first.id, poll_id: poll.id) get "/poll_votes/#{poll.id}" - expect(JSON.parse(response.body)["voting_data"]["votes_count"]).to eq(1) - expect(JSON.parse(response.body)["voting_data"]["votes_distribution"]).to include([poll.poll_options.first.id, 1]) - expect(JSON.parse(response.body)["poll_id"]).to eq(poll.id) - expect(JSON.parse(response.body)["voted"]).to be(true) + expect(response.parsed_body["voting_data"]["votes_count"]).to eq(1) + expect(response.parsed_body["voting_data"]["votes_distribution"]).to include([poll.poll_options.first.id, 1]) + expect(response.parsed_body["poll_id"]).to eq(poll.id) + expect(response.parsed_body["voted"]).to be(true) end end @@ -31,10 +31,10 @@ RSpec.describe "PollVotes" do post "/poll_votes", params: { poll_vote: { poll_option_id: poll.poll_options.first.id } } - expect(JSON.parse(response.body)["voting_data"]["votes_count"]).to eq(1) - expect(JSON.parse(response.body)["voting_data"]["votes_distribution"]).to include([poll.poll_options.first.id, 1]) - expect(JSON.parse(response.body)["poll_id"]).to eq(poll.id) - expect(JSON.parse(response.body)["voted"]).to be(true) + expect(response.parsed_body["voting_data"]["votes_count"]).to eq(1) + expect(response.parsed_body["voting_data"]["votes_distribution"]).to include([poll.poll_options.first.id, 1]) + expect(response.parsed_body["poll_id"]).to eq(poll.id) + expect(response.parsed_body["voted"]).to be(true) expect(user.poll_votes.size).to eq(1) end @@ -45,9 +45,9 @@ RSpec.describe "PollVotes" do post "/poll_votes", params: { poll_vote: { poll_option_id: poll.poll_options.first.id } } - expect(JSON.parse(response.body)["voting_data"]["votes_count"]).to eq(1) - expect(JSON.parse(response.body)["voting_data"]["votes_distribution"]).to include([poll.poll_options.first.id, 1]) - expect(JSON.parse(response.body)["voted"]).to be(true) + expect(response.parsed_body["voting_data"]["votes_count"]).to eq(1) + expect(response.parsed_body["voting_data"]["votes_distribution"]).to include([poll.poll_options.first.id, 1]) + expect(response.parsed_body["voted"]).to be(true) expect(user.poll_votes.size).to eq(1) end end diff --git a/spec/requests/response_templates_spec.rb b/spec/requests/response_templates_spec.rb index 8038a7414..0e9b0850e 100644 --- a/spec/requests/response_templates_spec.rb +++ b/spec/requests/response_templates_spec.rb @@ -39,7 +39,7 @@ RSpec.describe "ResponseTemplate" do create_list(:response_template, 2, user: nil, type_of: "mod_comment") create_list(:response_template, 2, user: user, type_of: "personal_comment") get response_templates_path, params: { type_of: nil }, headers: { HTTP_ACCEPT: "application/json" } - json = JSON.parse(response.body) + json = response.parsed_body expect(json.keys).to contain_exactly("personal_comment") expect(json.values.flatten.count).to eq(2) end @@ -83,14 +83,14 @@ RSpec.describe "ResponseTemplate" do create_list(:response_template, 2, user: nil, type_of: "mod_comment") create_list(:response_template, 2, user: moderator, type_of: "personal_comment") get response_templates_path, params: { type_of: "mod_comment" }, headers: { HTTP_ACCEPT: "application/json" } - expect(JSON.parse(response.body).length).to eq 2 + expect(response.parsed_body.length).to eq 2 end it "returns both personal and moderator response templates if type_of unspecified" do create_list(:response_template, 2, user: nil, type_of: "mod_comment") create_list(:response_template, 2, user: moderator, type_of: "personal_comment") get response_templates_path, params: { type_of: nil }, headers: { HTTP_ACCEPT: "application/json" } - json = JSON.parse(response.body) + json = response.parsed_body expect(json.keys).to contain_exactly("mod_comment", "personal_comment") expect(json.values.flatten.count).to eq(4) end @@ -114,7 +114,7 @@ RSpec.describe "ResponseTemplate" do it "allows access and returns an array of admin level response templates" do create_list(:response_template, 2, user: nil, type_of: "email_reply", content_type: "html") get response_templates_path, params: { type_of: "email_reply" }, headers: { HTTP_ACCEPT: "application/json" } - expect(JSON.parse(response.body).length).to eq 2 + expect(response.parsed_body.length).to eq 2 end end end diff --git a/spec/requests/shared_examples/comment_hide_or_unhide_request.rb b/spec/requests/shared_examples/comment_hide_or_unhide_request.rb index e09e04324..b2aeca966 100644 --- a/spec/requests/shared_examples/comment_hide_or_unhide_request.rb +++ b/spec/requests/shared_examples/comment_hide_or_unhide_request.rb @@ -34,7 +34,7 @@ RSpec.shared_examples "PATCH /comments/:comment_id/hide or unhide" do |args| end it "returns a proper JSON response" do - expect(JSON.parse(response.body)).to eq("hidden" => args[:hidden]) + expect(response.parsed_body).to eq("hidden" => args[:hidden]) end it "returns 200 on a good request" do diff --git a/spec/requests/tags_spec.rb b/spec/requests/tags_spec.rb index d38c9fb36..032f5cefc 100644 --- a/spec/requests/tags_spec.rb +++ b/spec/requests/tags_spec.rb @@ -75,7 +75,7 @@ RSpec.describe "Tags", proper_status: true do expect(response).to have_http_status(:ok) expect(response.content_type).to match(%r{application/json; charset=utf-8}i) - response_tag = JSON.parse(response.body).first + response_tag = response.parsed_body.first expect(response_tag["name"]).to eq(tag.name) expect(response_tag).to have_key("rules_html") expect(response_tag).to have_key("short_summary") diff --git a/spec/requests/universal_links_spec.rb b/spec/requests/universal_links_spec.rb index 3701a0b08..0cdf5f95f 100644 --- a/spec/requests/universal_links_spec.rb +++ b/spec/requests/universal_links_spec.rb @@ -14,7 +14,7 @@ RSpec.describe "Universal Links (Apple)" do create(:consumer_app, platform: Device::ANDROID) get aasa_route - json_response = JSON.parse(response.body) + json_response = response.parsed_body both_app_ids = [forem_app_id, ios_app.app_bundle] expect(response).to have_http_status(:ok) @@ -29,7 +29,7 @@ RSpec.describe "Universal Links (Apple)" do context "without any custom ConsumerApps" do it "responds with applinks support for Forem app" do get aasa_route - json_response = JSON.parse(response.body) + json_response = response.parsed_body expect(response).to have_http_status(:ok) expect(json_response.dig("applinks", "apps")).to be_empty @@ -44,7 +44,7 @@ RSpec.describe "Universal Links (Apple)" do it "responds with applinks support for Forem app", :aggregate_failures do allow(Settings::UserExperience).to receive(:public).and_return(false) get aasa_route - json_response = JSON.parse(response.body) + json_response = response.parsed_body expect(response).to have_http_status(:ok) expect(json_response.dig("applinks", "apps")).to be_empty diff --git a/spec/routing/all_routes_spec.rb b/spec/routing/all_routes_spec.rb index 69d47d649..ad0948b69 100644 --- a/spec/routing/all_routes_spec.rb +++ b/spec/routing/all_routes_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "all routes", type: :routing do +RSpec.describe "all routes" do let(:podcast) { create(:podcast) } let(:user) { create(:user) } diff --git a/spec/routing/data_update_scripts_admin_routes_spec.rb b/spec/routing/data_update_scripts_admin_routes_spec.rb index 1512a113c..910cc1558 100644 --- a/spec/routing/data_update_scripts_admin_routes_spec.rb +++ b/spec/routing/data_update_scripts_admin_routes_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Data Update Scripts admin routes", type: :routing do +RSpec.describe "Data Update Scripts admin routes" do it "renders the data update scripts admin route if the feature flag is enabled" do allow(FeatureFlag).to receive(:enabled?).with(:data_update_scripts).and_return(true) diff --git a/spec/routing/i18n_routes_spec.rb b/spec/routing/i18n_routes_spec.rb index 4af1fd71f..170b3c0b7 100644 --- a/spec/routing/i18n_routes_spec.rb +++ b/spec/routing/i18n_routes_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "i8n routes", type: :routing do +RSpec.describe "i8n routes" do let(:locale) { "fr-ca" } let(:i18n_route) { "/locale/#{locale}" } let(:user) { create(:user) } diff --git a/spec/routing/profile_admin_routes_spec.rb b/spec/routing/profile_admin_routes_spec.rb index 492c872d8..843105860 100644 --- a/spec/routing/profile_admin_routes_spec.rb +++ b/spec/routing/profile_admin_routes_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Profile admin routes", type: :routing do +RSpec.describe "Profile admin routes" do it "renders the profile admin route" do expect(get: admin_profile_fields_path).to route_to( controller: "admin/profile_fields", diff --git a/spec/services/bulk_sql_delete_spec.rb b/spec/services/bulk_sql_delete_spec.rb index feb1f1dd3..7b9df690c 100644 --- a/spec/services/bulk_sql_delete_spec.rb +++ b/spec/services/bulk_sql_delete_spec.rb @@ -18,7 +18,7 @@ describe BulkSqlDelete, type: :service do describe "#delete_in_batches" do it "logs batch deletion" do - create_list :notification, 3, created_at: 1.month.ago + create_list(:notification, 3, created_at: 1.month.ago) allow(logger).to receive(:info) described_class.delete_in_batches(sql) expect(logger).to have_received(:info).exactly(4).times.with( @@ -40,7 +40,7 @@ describe BulkSqlDelete, type: :service do end it "deletes all records in batches" do - create_list :notification, 5, created_at: 1.month.ago + create_list(:notification, 5, created_at: 1.month.ago) result = described_class.delete_in_batches(sql) expect(result).to eq(5) end diff --git a/spec/services/calculate_reaction_points_spec.rb b/spec/services/calculate_reaction_points_spec.rb index cb2b548d9..ef076e3d4 100644 --- a/spec/services/calculate_reaction_points_spec.rb +++ b/spec/services/calculate_reaction_points_spec.rb @@ -12,8 +12,8 @@ RSpec.describe CalculateReactionPoints, type: :service do end context "when reaction is to comment on author's post" do - let(:comment) { build :comment, commentable: article } - let(:reaction) { build :reaction, reactable: comment, user: user } + let(:comment) { build(:comment, commentable: article) } + let(:reaction) { build(:reaction, reactable: comment, user: user) } it "assigns extra 5 points" do expect(calculated_points).to eq(5.0) @@ -36,7 +36,7 @@ RSpec.describe CalculateReactionPoints, type: :service do context "when newish user" do let(:newish_user) { create(:user, registered_at: 3.days.ago) } - let(:reaction) { build :reaction, reactable: article, user: newish_user } + let(:reaction) { build(:reaction, reactable: article, user: newish_user) } it "assigns fractional points to new users on create" do expect(calculated_points).to be_within(0.1).of(0.3) diff --git a/spec/services/comment_creator_spec.rb b/spec/services/comment_creator_spec.rb index d7eb975c3..783283c1a 100644 --- a/spec/services/comment_creator_spec.rb +++ b/spec/services/comment_creator_spec.rb @@ -3,8 +3,8 @@ require "rails_helper" RSpec.describe CommentCreator, type: :service do subject(:creator) { described_class.build_comment params, current_user: user } - let(:user) { create :user } - let(:commentable) { create :article } + let(:user) { create(:user) } + let(:commentable) { create(:article) } let(:record) { Comment.new user: user } let(:params) do { diff --git a/spec/services/display_ad_event_rollup_spec.rb b/spec/services/display_ad_event_rollup_spec.rb index 997d7437c..b19b126db 100644 --- a/spec/services/display_ad_event_rollup_spec.rb +++ b/spec/services/display_ad_event_rollup_spec.rb @@ -1,10 +1,10 @@ require "rails_helper" RSpec.describe DisplayAdEventRollup, type: :service do - let(:ad1) { create :display_ad } - let(:ad2) { create :display_ad } - let(:user1) { create :user } - let(:user2) { create :user } + let(:ad1) { create(:display_ad) } + let(:ad2) { create(:display_ad) } + let(:user1) { create(:user) } + let(:user2) { create(:user) } def override_timestamps DisplayAdEvent.record_timestamps = false diff --git a/spec/services/notifications/new_follower/send_spec.rb b/spec/services/notifications/new_follower/send_spec.rb index 4398af434..33badc62f 100644 --- a/spec/services/notifications/new_follower/send_spec.rb +++ b/spec/services/notifications/new_follower/send_spec.rb @@ -104,7 +104,7 @@ RSpec.describe Notifications::NewFollower::Send, type: :service do notification = described_class.call(follow_data(follow2)) expect(notification.notifiable).to eq(follow2) expect(notification.notified_at).not_to be_nil - expect(notification.json_data["aggregated_siblings"].map { |j| j["id"] }.sort).to eq([user.id, user3.id].sort) + expect(notification.json_data["aggregated_siblings"].pluck("id").sort).to eq([user.id, user3.id].sort) end it "creates a notification with user data" do diff --git a/spec/services/notifications/welcome_notification/send_spec.rb b/spec/services/notifications/welcome_notification/send_spec.rb index bc94bc0c0..f6ba4a90b 100644 --- a/spec/services/notifications/welcome_notification/send_spec.rb +++ b/spec/services/notifications/welcome_notification/send_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Notifications::WelcomeNotification::Send, type: :service do described_class.call(create(:user).id, welcome_broadcast) welcome_notification = Notification.find_by(notifiable_id: welcome_broadcast.id) - expect(welcome_notification).to be_kind_of(Notification) + expect(welcome_notification).to be_a(Notification) expect(welcome_notification.notifiable_type).to eq "Broadcast" expect(welcome_notification.action).to eq "Welcome" expect(welcome_notification.json_data["broadcast"]["processed_html"]).to eq welcome_broadcast.processed_html diff --git a/spec/services/podcasts/episode_rss_item_spec.rb b/spec/services/podcasts/episode_rss_item_spec.rb index f6113409b..349aac9b5 100644 --- a/spec/services/podcasts/episode_rss_item_spec.rb +++ b/spec/services/podcasts/episode_rss_item_spec.rb @@ -30,7 +30,7 @@ RSpec.describe Podcasts::EpisodeRssItem, type: :service do describe "#from_item" do it "returns a hash" do attributes = described_class.from_item(item).to_h - expect(attributes).to be_kind_of(Hash) + expect(attributes).to be_a(Hash) expect(attributes[:title]).to eq("lightalloy's podcast") expect(attributes[:enclosure_url]).to eq("https://audio.simplecast.com/2330f132.mp3") expect(attributes[:body]).to eq("world") diff --git a/spec/services/search/username_spec.rb b/spec/services/search/username_spec.rb index 5f8f3fb51..c4e563d28 100644 --- a/spec/services/search/username_spec.rb +++ b/spec/services/search/username_spec.rb @@ -91,12 +91,12 @@ RSpec.describe Search::Username, type: :service do end describe "::search_documents with context" do - let(:article) { create :article, user: author } - let(:author) { create :user, name: "Person A", username: "author" } - let(:commenter) { create :user, name: "Person B", username: "commentator" } + let(:article) { create(:article, user: author) } + let(:author) { create(:user, name: "Person A", username: "author") } + let(:commenter) { create(:user, name: "Person B", username: "commentator") } before do - create :comment, user: commenter, commentable: article + create(:comment, user: commenter, commentable: article) end it "returns data in the expected format" do @@ -157,7 +157,7 @@ RSpec.describe Search::Username, type: :service do end it "ranks unrelated user lower" do - create :user, username: "unrelated", name: "Person C" + create(:user, username: "unrelated", name: "Person C") results = search("Per", context: article) @@ -165,7 +165,7 @@ RSpec.describe Search::Username, type: :service do end it "does not have authorship ranking for PodcastEpisode (yet)" do - pod_ep = create :podcast_episode + pod_ep = create(:podcast_episode) results = search("Per", context: pod_ep) diff --git a/spec/support/initializers/capybara.rb b/spec/support/initializers/capybara.rb index a2806319c..9db50a57a 100644 --- a/spec/support/initializers/capybara.rb +++ b/spec/support/initializers/capybara.rb @@ -6,18 +6,16 @@ Capybara.default_max_wait_time = 2 Capybara.register_driver(:better_cuprite) do |app| Capybara::Cuprite::Driver.new( app, - **{ - window_size: [1200, 800], - # See additional options for Dockerized environment in the respective section of this article - browser_options: {}, - # Increase Chrome startup wait time (required for stable CI builds) - process_timeout: 10, - # Enable debugging capabilities - inspector: true, - # Allow running Chrome in a headful mode by setting HEADLESS env - # var to a falsey value - headless: !ENV["HEADLESS"].in?(%w[n 0 no false]) - }, + window_size: [1200, 800], + # See additional options for Dockerized environment in the respective section of this article + browser_options: {}, + # Increase Chrome startup wait time (required for stable CI builds) + process_timeout: 10, + # Enable debugging capabilities + inspector: true, + # Allow running Chrome in a headful mode by setting HEADLESS env + # var to a falsey value + headless: !ENV["HEADLESS"].in?(%w[n 0 no false]), ) end @@ -26,7 +24,7 @@ RSpec.configure do |config| driven_by :rack_test end - config.before(:each, type: :system, js: true) do + config.before(:each, js: true, type: :system) do driven_by :better_cuprite end end diff --git a/spec/support/seeds/seeds_e2e.rb b/spec/support/seeds/seeds_e2e.rb index 0e9b3d46b..8e8105472 100644 --- a/spec/support/seeds/seeds_e2e.rb +++ b/spec/support/seeds/seeds_e2e.rb @@ -40,7 +40,7 @@ seeder.create_if_doesnt_exist(User, "email", "admin@forem.local") do name: "Admin McAdmin", email: "admin@forem.local", username: "Admin_McAdmin", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: "2020-01-01T13:09:47+0000", created_at: "2020-01-01T13:09:47+0000", @@ -79,7 +79,7 @@ seeder.create_if_doesnt_exist(User, "email", "trusted-user-1@forem.local") do name: "Trusted User 1 \\:/", email: "trusted-user-1@forem.local", username: "trusted_user_1", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -108,7 +108,7 @@ seeder.create_if_doesnt_exist(User, "email", "punctuated-name-user@forem.local") name: "User \"The test breaker\" A'postrophe \\:/", email: "punctuated-name-user@forem.local", username: "punctuated_name_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -145,7 +145,7 @@ seeder.create_if_doesnt_exist(User, "email", "user-with-many-orgs@forem.local") name: "Many orgs user", email: "user-with-many-orgs@forem.local", username: "many_orgs_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -165,7 +165,7 @@ seeder.create_if_doesnt_exist(User, "email", "gdpr-delete-user@forem.local") do name: "GDPR delete user", email: "gdpr-delete-user@forem.local", username: "gdpr_delete_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -184,7 +184,7 @@ seeder.create_if_doesnt_exist(User, "email", "moderator-user@forem.local") do name: "Moderator User", email: "moderator-user@forem.local", username: "moderator_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -210,7 +210,7 @@ seeder.create_if_doesnt_exist(Organization, "slug", "bachmanity") do organization = Organization.create!( name: "Bachmanity", summary: Faker::Company.bs, - profile_image: logo = File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: logo = Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, nav_image: logo, url: Faker::Internet.url, slug: "bachmanity", @@ -233,7 +233,7 @@ seeder.create_if_doesnt_exist(Organization, "slug", "awesomeorg") do organization = Organization.create!( name: "Awesome Org", summary: Faker::Company.bs, - profile_image: logo = File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: logo = Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, nav_image: logo, url: Faker::Internet.url, slug: "awesomeorg", @@ -256,7 +256,7 @@ seeder.create_if_doesnt_exist(Organization, "slug", "org3") do organization = Organization.create!( name: "Org 3", summary: Faker::Company.bs, - profile_image: logo = File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: logo = Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, nav_image: logo, url: Faker::Internet.url, slug: "org3", @@ -273,7 +273,7 @@ seeder.create_if_doesnt_exist(Organization, "slug", "org4") do organization = Organization.create!( name: "Org 4", summary: Faker::Company.bs, - profile_image: logo = File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: logo = Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, nav_image: logo, url: Faker::Internet.url, slug: "org4", @@ -293,7 +293,7 @@ seeder.create_if_doesnt_exist(User, "email", "change-password-user@forem.com") d name: "Change Password User", email: "change-password-user@forem.com", username: "changepassworduser", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -320,7 +320,7 @@ seeder.create_if_doesnt_exist(User, "email", "article-editor-v1-user@forem.local name: "Article Editor v1 User", email: "article-editor-v1-user@forem.local", username: "article_editor_v1_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -348,7 +348,7 @@ seeder.create_if_doesnt_exist(User, "email", "article-editor-v2-user@forem.local name: "Article Editor v2 User", email: "article-editor-v2-user@forem.local", username: "article_editor_v2_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -375,7 +375,7 @@ seeder.create_if_doesnt_exist(User, "email", "apple-auth-admin-user@privaterelay name: "Apple Auth Admin User", email: "apple-auth-admin-user@privaterelay.appleid.com", username: "apple_auth_admin_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -395,7 +395,7 @@ seeder.create_if_doesnt_exist(User, "email", "notifications-user@forem.local") d name: "Notifications User \\:/", email: "notifications-user@forem.local", username: "notifications_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -468,7 +468,7 @@ seeder.create_if_doesnt_exist(User, "email", "liquid-tags-user@forem.local") do name: "Liquid tags User", email: "liquid-tags-user@forem.local", username: "liquid_tags_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -495,7 +495,7 @@ seeder.create_if_doesnt_exist(User, "email", "credits-user@forem.local") do name: "Credits User", email: "credits-user@forem.local", username: "credits_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -524,7 +524,7 @@ seeder.create_if_none(NavigationLink) do protocol = ApplicationConfig["APP_PROTOCOL"].freeze domain = Rails.application&.initialized? ? Settings::General.app_domain : ApplicationConfig["APP_DOMAIN"] base_url = "#{protocol}#{domain}".freeze - reading_icon = File.read(Rails.root.join("app/assets/images/twemoji/drawer.svg")).freeze + reading_icon = Rails.root.join("app/assets/images/twemoji/drawer.svg").read.freeze NavigationLink.create!( name: "Reading List", @@ -679,7 +679,7 @@ seeder.create_if_doesnt_exist(User, "email", "tech-admin-user@forem.local") do name: "Tech admin User", email: "tech-admin-user@forem.local", username: "tech_admin_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -699,7 +699,7 @@ seeder.create_if_doesnt_exist(User, "email", "series-user@forem.local") do name: "Series User", email: "series-user@forem.local", username: "series_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -728,7 +728,7 @@ seeder.create_if_doesnt_exist(User, "email", "suspended-user@forem.local") do name: "Suspended User", email: "suspended-user@forem.local", username: "suspended_user", - profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + profile_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, confirmed_at: Time.current, registered_at: Time.current, password: "password", @@ -866,7 +866,7 @@ seeder.create_if_none(Badge) do Badge.create!( title: "#{Faker::Lorem.word} #{rand(100)}", description: Faker::Lorem.sentence, - badge_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + badge_image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, ) admin_user.badge_achievements.create!( @@ -904,7 +904,7 @@ seeder.create_if_doesnt_exist(Podcast, "title", "Developer on Fire") do main_color_hex: "343d46", overcast_url: "https://overcast.fm/itunes1006105326/developer-on-fire", android_url: "http://subscribeonandroid.com/developeronfire.com/rss.xml", - image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")), + image: Rails.root.join("app/assets/images/#{rand(1..40)}.png").open, published: true } podcast = Podcast.create!(podcast_attributes) diff --git a/spec/system/admin/admin_awards_badges_spec.rb b/spec/system/admin/admin_awards_badges_spec.rb index 9d8c59627..e82e1b64a 100644 --- a/spec/system/admin/admin_awards_badges_spec.rb +++ b/spec/system/admin/admin_awards_badges_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin awards badges", type: :system do +RSpec.describe "Admin awards badges" do let(:admin) { create(:user, :super_admin) } let(:user) { create(:user) } let(:user2) { create(:user) } @@ -20,7 +20,7 @@ RSpec.describe "Admin awards badges", type: :system do end before do - create_list :badge, 5 + create_list(:badge, 5) sign_in admin visit admin_badge_achievements_award_badges_path end diff --git a/spec/system/admin/admin_creates_new_page_spec.rb b/spec/system/admin/admin_creates_new_page_spec.rb index d65e22c29..f2791294d 100644 --- a/spec/system/admin/admin_creates_new_page_spec.rb +++ b/spec/system/admin/admin_creates_new_page_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin creates new page", type: :system do +RSpec.describe "Admin creates new page" do let(:admin) { create(:user, :super_admin) } context "when we pass through a slug param" do diff --git a/spec/system/admin/admin_creates_new_tag_spec.rb b/spec/system/admin/admin_creates_new_tag_spec.rb index ee624d698..4a4e6504e 100644 --- a/spec/system/admin/admin_creates_new_tag_spec.rb +++ b/spec/system/admin/admin_creates_new_tag_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin creates new tag", type: :system do +RSpec.describe "Admin creates new tag" do let(:admin) { create(:user, :super_admin) } before do diff --git a/spec/system/admin/admin_deletes_user_spec.rb b/spec/system/admin/admin_deletes_user_spec.rb index 0accf907e..550a94d93 100644 --- a/spec/system/admin/admin_deletes_user_spec.rb +++ b/spec/system/admin/admin_deletes_user_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin deletes user", type: :system do +RSpec.describe "Admin deletes user" do let(:admin) { create(:user, :super_admin) } let(:user) { create(:user) } diff --git a/spec/system/admin/admin_invites_user_spec.rb b/spec/system/admin/admin_invites_user_spec.rb index e80361d79..639c97938 100644 --- a/spec/system/admin/admin_invites_user_spec.rb +++ b/spec/system/admin/admin_invites_user_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin invites user", type: :system do +RSpec.describe "Admin invites user" do let(:admin) { create(:user, :super_admin) } before do diff --git a/spec/system/admin/admin_manages_organizations_spec.rb b/spec/system/admin/admin_manages_organizations_spec.rb index b94f3fcb6..a99c7c678 100644 --- a/spec/system/admin/admin_manages_organizations_spec.rb +++ b/spec/system/admin/admin_manages_organizations_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin manages organizations", type: :system do +RSpec.describe "Admin manages organizations" do let(:admin) { create(:user, :super_admin) } let(:organization) { create(:organization) } @@ -8,7 +8,7 @@ RSpec.describe "Admin manages organizations", type: :system do context "when searching for organizations" do it "searches for organizations" do - create_list :organization, 5 + create_list(:organization, 5) visit admin_organizations_path fill_in "search", with: organization.name.to_s @@ -23,7 +23,7 @@ RSpec.describe "Admin manages organizations", type: :system do it "does not show the remove form when there are no credits" do expect(page).to have_button("Add Org Credits") - expect(page).to have_no_button("Remove Org Credits") + expect(page).not_to have_button("Remove Org Credits") end end end diff --git a/spec/system/admin/admin_manages_pages_spec.rb b/spec/system/admin/admin_manages_pages_spec.rb index 6a9ff7da8..582639490 100644 --- a/spec/system/admin/admin_manages_pages_spec.rb +++ b/spec/system/admin/admin_manages_pages_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin manages pages", type: :system do +RSpec.describe "Admin manages pages" do let(:admin) { create(:user, :super_admin) } before do diff --git a/spec/system/admin/admin_manages_profile_fields_spec.rb b/spec/system/admin/admin_manages_profile_fields_spec.rb index 15ed1591f..04639ceea 100644 --- a/spec/system/admin/admin_manages_profile_fields_spec.rb +++ b/spec/system/admin/admin_manages_profile_fields_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin manages profile fields", type: :system do +RSpec.describe "Admin manages profile fields" do let(:admin) { create(:user, :super_admin) } let!(:profile_field_group) { create(:profile_field_group, name: "Delete Me") } let(:label) { "Delete Me Too" } diff --git a/spec/system/admin/admin_manages_reports_spec.rb b/spec/system/admin/admin_manages_reports_spec.rb index 2b18815a6..76ca1d756 100644 --- a/spec/system/admin/admin_manages_reports_spec.rb +++ b/spec/system/admin/admin_manages_reports_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin manages reports", type: :system do +RSpec.describe "Admin manages reports" do let(:admin) { create(:user, :super_admin) } def clear_search_boxes diff --git a/spec/system/admin/admin_updates_tag_spec.rb b/spec/system/admin/admin_updates_tag_spec.rb index 2bd236448..afa5c811d 100644 --- a/spec/system/admin/admin_updates_tag_spec.rb +++ b/spec/system/admin/admin_updates_tag_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin updates a tag", type: :system do +RSpec.describe "Admin updates a tag" do let(:super_admin) { create(:user, :super_admin) } let(:bg_color_hex) { "#000000" } diff --git a/spec/system/admin/admin_views_tags_spec.rb b/spec/system/admin/admin_views_tags_spec.rb index aafaea6e8..3ed81b418 100644 --- a/spec/system/admin/admin_views_tags_spec.rb +++ b/spec/system/admin/admin_views_tags_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin updates a tag", type: :system do +RSpec.describe "Admin updates a tag" do let(:super_admin) { create(:user, :super_admin) } let!(:tag1) { create(:tag, name: "alpha", supported: true, taggings_count: 1) } let!(:tag2) { create(:tag, name: "betical", supported: false, taggings_count: 2) } diff --git a/spec/system/admin/admin_visits_overview_spec.rb b/spec/system/admin/admin_visits_overview_spec.rb index 068f35c8b..c47fb4fd1 100644 --- a/spec/system/admin/admin_visits_overview_spec.rb +++ b/spec/system/admin/admin_visits_overview_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin visits overview page", type: :system, js: true do +RSpec.describe "Admin visits overview page", js: true do let(:super_admin) { create(:user, :super_admin) } before do diff --git a/spec/system/admin/config/admin_updates_smtp_settings_spec.rb b/spec/system/admin/config/admin_updates_smtp_settings_spec.rb index 81dbb61d5..21cc7c08b 100644 --- a/spec/system/admin/config/admin_updates_smtp_settings_spec.rb +++ b/spec/system/admin/config/admin_updates_smtp_settings_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Admin updates SMTP Settings", type: :system do +RSpec.describe "Admin updates SMTP Settings" do let(:admin) { create(:user, :super_admin) } before do diff --git a/spec/system/articles/feeds/basic_spec.rb b/spec/system/articles/feeds/basic_spec.rb index 79326c6a5..73be48e7d 100644 --- a/spec/system/articles/feeds/basic_spec.rb +++ b/spec/system/articles/feeds/basic_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Articles::Feeds::Basic, type: :system, js: true do +RSpec.describe Articles::Feeds::Basic, js: true do let(:user) { create(:user) } let(:hot_story) do create(:article, :past, hotness_score: 1000, score: 1000, past_published_at: 3.hours.ago) @@ -13,7 +13,7 @@ RSpec.describe Articles::Feeds::Basic, type: :system, js: true do context "with a user" do let(:feed) { described_class.new(user: user, number_of_articles: 100, page: 1) } - it "doesn't display blocked articles", type: :system, js: true do + it "doesn't display blocked articles", js: true, type: :system do selector = "article[data-content-user-id='#{hot_story.user_id}']" sign_in user visit root_path diff --git a/spec/system/articles/feeds/large_forem_experimental_spec.rb b/spec/system/articles/feeds/large_forem_experimental_spec.rb index 09d5c7b0a..4b5880f77 100644 --- a/spec/system/articles/feeds/large_forem_experimental_spec.rb +++ b/spec/system/articles/feeds/large_forem_experimental_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Articles::Feeds::LargeForemExperimental, type: :system, js: true do +RSpec.describe Articles::Feeds::LargeForemExperimental, js: true do let(:user) { create(:user) } let(:second_user) { create(:user) } let!(:hot_story) do diff --git a/spec/system/articles/moderator_moderates_an_article_spec.rb b/spec/system/articles/moderator_moderates_an_article_spec.rb index fac1876cf..dc56ee0d5 100644 --- a/spec/system/articles/moderator_moderates_an_article_spec.rb +++ b/spec/system/articles/moderator_moderates_an_article_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Views an article", type: :system do +RSpec.describe "Views an article" do let(:user) { create(:user) } let(:moderator) { create(:user, :trusted) } let(:article) { create(:article, :with_notification_subscription, user: user) } @@ -17,7 +17,6 @@ RSpec.describe "Views an article", type: :system do expect(page).to have_content(article.title) end - # rubocop:disable Rspec/Capybara/SpecificMatcher it "lets moderators visit /mod", js: true do visit "/#{user.username}/#{article.slug}/mod" expect(page).to have_selector('button[data-category="thumbsdown"][data-reactable-type="Article"]') @@ -25,7 +24,6 @@ RSpec.describe "Views an article", type: :system do expect(page).to have_selector('button[data-category="vomit"][data-reactable-type="User"]') expect(page).to have_button(class: "level-rating-button") end - # rubocop:enable Rspec/Capybara/SpecificMatcher it "shows hidden comments on /mod" do commenter = create(:user) diff --git a/spec/system/articles/user_creates_an_article_spec.rb b/spec/system/articles/user_creates_an_article_spec.rb index fb0e59037..da65b4c69 100644 --- a/spec/system/articles/user_creates_an_article_spec.rb +++ b/spec/system/articles/user_creates_an_article_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Creating an article with the editor", type: :system do +RSpec.describe "Creating an article with the editor" do include_context "with runkit_tag" let(:user) do diff --git a/spec/system/articles/user_deletes_an_article_spec.rb b/spec/system/articles/user_deletes_an_article_spec.rb index b403841e7..93b205444 100644 --- a/spec/system/articles/user_deletes_an_article_spec.rb +++ b/spec/system/articles/user_deletes_an_article_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Deleting Article", type: :system do +RSpec.describe "Deleting Article" do let(:article) { create(:article) } before do diff --git a/spec/system/articles/user_discussion_locks_spec.rb b/spec/system/articles/user_discussion_locks_spec.rb index 238419c3d..e9036326d 100644 --- a/spec/system/articles/user_discussion_locks_spec.rb +++ b/spec/system/articles/user_discussion_locks_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User discussion locks", type: :system, js: true do +RSpec.describe "User discussion locks", js: true do let(:user) { create(:user) } let(:article) { create(:article, user: user) } let(:discussion_lock) { create(:discussion_lock, article: article, locking_user: user) } diff --git a/spec/system/articles/user_edits_an_article_spec.rb b/spec/system/articles/user_edits_an_article_spec.rb index aafd9ac44..556b3df53 100644 --- a/spec/system/articles/user_edits_an_article_spec.rb +++ b/spec/system/articles/user_edits_an_article_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Editing with an editor", type: :system, js: true do +RSpec.describe "Editing with an editor", js: true do let(:template) { file_fixture("article_published.txt").read } let(:user) { create(:user) } let(:article) { create(:article, user: user, body_markdown: template) } diff --git a/spec/system/articles/user_visits_an_article_spec.rb b/spec/system/articles/user_visits_an_article_spec.rb index c8d8eea8e..b0fc57c57 100644 --- a/spec/system/articles/user_visits_an_article_spec.rb +++ b/spec/system/articles/user_visits_an_article_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Views an article", type: :system do +RSpec.describe "Views an article" do let(:user) { create(:user) } let(:article) do create(:article, :with_notification_subscription, user: user) @@ -159,7 +159,7 @@ RSpec.describe "Views an article", type: :system do it "doesn't show the article manage link, even for the author", js: true do visit scheduled_article_path - expect(page).to have_no_link("article-action-space-manage") + expect(page).not_to have_link("article-action-space-manage") end it "doesn't show an article edit link for the non-authorized user" do diff --git a/spec/system/articles/user_visits_article_stats_spec.rb b/spec/system/articles/user_visits_article_stats_spec.rb index 106d60698..b1870c352 100644 --- a/spec/system/articles/user_visits_article_stats_spec.rb +++ b/spec/system/articles/user_visits_article_stats_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Viewing an article stats", type: :system, js: true do +RSpec.describe "Viewing an article stats", js: true do let(:user) { create(:user) } let(:article) { create(:article, user: user) } 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 a21c5bdaa..aa2bf9648 100644 --- a/spec/system/articles/user_visits_articles_by_tag_spec.rb +++ b/spec/system/articles/user_visits_articles_by_tag_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User visits articles by tag", type: :system do +RSpec.describe "User visits articles by tag" do let(:js_tag) { create(:tag, name: "javascript") } let(:iot_tag) { create(:tag, name: "IoT") } let!(:func_tag) { create(:tag, name: "functional") } diff --git a/spec/system/authentication/conditional_registration_spec.rb b/spec/system/authentication/conditional_registration_spec.rb index b777dd66e..4555a1823 100644 --- a/spec/system/authentication/conditional_registration_spec.rb +++ b/spec/system/authentication/conditional_registration_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" # This test file can be removed once we have a longterm solution for # ForemWebView contexts when Apple Auth isn't enabled -RSpec.describe "Conditional registration (ForemWebView)", type: :system do +RSpec.describe "Conditional registration (ForemWebView)" do let(:all_providers) { Authentication::Providers.available } let(:all_providers_except_apple) { Authentication::Providers.available - %i[apple] } let(:all_providers_minus_apple_forem) { Authentication::Providers.available - %i[apple forem] } diff --git a/spec/system/authentication/creator_config_edit_spec.rb b/spec/system/authentication/creator_config_edit_spec.rb index db180cc93..37b241ed5 100644 --- a/spec/system/authentication/creator_config_edit_spec.rb +++ b/spec/system/authentication/creator_config_edit_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Creator config edit", type: :system, js: true do +RSpec.describe "Creator config edit", js: true do let(:admin) { create(:user, :super_admin) } context "when a creator browses /admin/customization/config" do diff --git a/spec/system/authentication/omniauth_redirect_uri_spec.rb b/spec/system/authentication/omniauth_redirect_uri_spec.rb index 444d0ce4b..807fc2b33 100644 --- a/spec/system/authentication/omniauth_redirect_uri_spec.rb +++ b/spec/system/authentication/omniauth_redirect_uri_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Omniauth redirect_uri", type: :system do +RSpec.describe "Omniauth redirect_uri" do let!(:test_app_domain) { Settings::General.app_domain } # Avoid messing with other tests by resetting back Settings::General.app_domain diff --git a/spec/system/authentication/redirects_using_referer_spec.rb b/spec/system/authentication/redirects_using_referer_spec.rb index 7b01b9f61..13e69c41e 100644 --- a/spec/system/authentication/redirects_using_referer_spec.rb +++ b/spec/system/authentication/redirects_using_referer_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Redirects authentication using Referer", type: :system do +RSpec.describe "Redirects authentication using Referer" do let(:article) { build(:article) } let(:user) do create(:user, :with_identity, identities: [:twitter]) diff --git a/spec/system/authentication/user_request_confirmation_spec.rb b/spec/system/authentication/user_request_confirmation_spec.rb index 5bb7442a3..007d0b3b7 100644 --- a/spec/system/authentication/user_request_confirmation_spec.rb +++ b/spec/system/authentication/user_request_confirmation_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "/confirm-email", type: :system do +RSpec.describe "/confirm-email" do it "stays on the same page and displays a flash message", :aggregate_failures do visit confirm_email_path fill_in "user_email", with: "test@example.com" diff --git a/spec/system/authentication/user_with_suspended_username_spec.rb b/spec/system/authentication/user_with_suspended_username_spec.rb index 747906050..13821c3c3 100644 --- a/spec/system/authentication/user_with_suspended_username_spec.rb +++ b/spec/system/authentication/user_with_suspended_username_spec.rb @@ -20,7 +20,7 @@ RSpec.describe "User with suspended username tried to sign up via OAuth" do click_on("Continue with Twitter", match: :first) expect(page).to have_current_path(root_path) - expected_message = ::Authentication::Errors::PreviouslySuspended.new.message + expected_message = Authentication::Errors::PreviouslySuspended.new.message expect(page).to have_content(expected_message) expect(ForemStatsClient) .to have_received(:increment) diff --git a/spec/system/banned_user_interactions_spec.rb b/spec/system/banned_user_interactions_spec.rb index 6e73fef26..e04dd53d7 100644 --- a/spec/system/banned_user_interactions_spec.rb +++ b/spec/system/banned_user_interactions_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Suspended user", type: :system do +RSpec.describe "Suspended user" do let(:suspended_user) { create(:user, :suspended) } it "tries to create an article" do diff --git a/spec/system/collections/user_views_collection_articles_spec.rb b/spec/system/collections/user_views_collection_articles_spec.rb index cecd966ad..20f5f934b 100644 --- a/spec/system/collections/user_views_collection_articles_spec.rb +++ b/spec/system/collections/user_views_collection_articles_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Viewing a collection", type: :system do +RSpec.describe "Viewing a collection" do let(:user) { create(:user) } let(:collection) { create(:collection, :with_articles, user: user) } diff --git a/spec/system/collections/user_views_collections_spec.rb b/spec/system/collections/user_views_collections_spec.rb index 5e7f55742..9c08af46c 100644 --- a/spec/system/collections/user_views_collections_spec.rb +++ b/spec/system/collections/user_views_collections_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Visiting collections", type: :system do +RSpec.describe "Visiting collections" do let(:user) { create(:user) } let!(:collection1_with_articles) { create(:collection, :with_articles, user: user) } let!(:collection2_with_articles) { create(:collection, :with_articles, user: user) } diff --git a/spec/system/comments/user_delete_a_comment_spec.rb b/spec/system/comments/user_delete_a_comment_spec.rb index 0b3feb23a..2fbe7d3c4 100644 --- a/spec/system/comments/user_delete_a_comment_spec.rb +++ b/spec/system/comments/user_delete_a_comment_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Deleting Comment", type: :system, js: true do +RSpec.describe "Deleting Comment", js: true do let(:user) { create(:user) } let(:raw_comment) { Faker::Lorem.paragraph } let(:article) do diff --git a/spec/system/comments/user_edits_a_comment_spec.rb b/spec/system/comments/user_edits_a_comment_spec.rb index 72ffae3e3..5f4717bd7 100644 --- a/spec/system/comments/user_edits_a_comment_spec.rb +++ b/spec/system/comments/user_edits_a_comment_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Editing A Comment", type: :system, js: true do +RSpec.describe "Editing A Comment", js: true do let(:user) { create(:user) } let!(:article) { create(:article, show_comments: true) } let(:new_comment_text) { Faker::Lorem.paragraph } diff --git a/spec/system/comments/user_fills_out_comment_spec.rb b/spec/system/comments/user_fills_out_comment_spec.rb index 1b27eed33..b0ddb8bbd 100644 --- a/spec/system/comments/user_fills_out_comment_spec.rb +++ b/spec/system/comments/user_fills_out_comment_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.xdescribe "Creating Comment", type: :system, js: true do +RSpec.xdescribe "Creating Comment", js: true do include_context "with runkit_tag" let(:user) { create(:user) } @@ -172,7 +172,7 @@ RSpec.xdescribe "Creating Comment", type: :system, js: true do visible: :hidden, ) - expect(page).to have_no_css("div.file-upload-error") + expect(page).not_to have_css("div.file-upload-error") end it "User attaches a large image" do diff --git a/spec/system/comments/user_views_a_comment_spec.rb b/spec/system/comments/user_views_a_comment_spec.rb index e5840ba32..6683897a1 100644 --- a/spec/system/comments/user_views_a_comment_spec.rb +++ b/spec/system/comments/user_views_a_comment_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Viewing a comment", type: :system, js: true do +RSpec.describe "Viewing a comment", js: true do let(:user) { create(:user) } let(:article) { create(:article, user_id: user.id, show_comments: true) } let(:comment) { create(:comment, commentable: article, user: user) } diff --git a/spec/system/comments/user_views_article_comments_spec.rb b/spec/system/comments/user_views_article_comments_spec.rb index 863322712..c81a05067 100644 --- a/spec/system/comments/user_views_article_comments_spec.rb +++ b/spec/system/comments/user_views_article_comments_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Visiting article comments", type: :system, js: true do +RSpec.describe "Visiting article comments", js: true do let(:user) { create(:user) } let(:article) { create(:article, user_id: user.id, show_comments: true) } let!(:comment) { create(:comment, commentable: article, user: user) } @@ -32,7 +32,7 @@ RSpec.describe "Visiting article comments", type: :system, js: true do end context "when root is specified" do - before { visit "#{article.path}/comments/#{comment.id.to_s(26)}" } # rubocop:disable Rails/ToSWithArgument + before { visit "#{article.path}/comments/#{comment.id.to_s(26)}" } it "displays related comments" do expect(page).to have_selector(".single-comment-node", visible: :visible, count: 4) diff --git a/spec/system/dashboards/user_followers_display_spec.rb b/spec/system/dashboards/user_followers_display_spec.rb index 528edd1e7..773a3667f 100644 --- a/spec/system/dashboards/user_followers_display_spec.rb +++ b/spec/system/dashboards/user_followers_display_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Followers Dashboard", type: :system, js: true do +RSpec.describe "Followers Dashboard", js: true do let(:default_per_page) { 3 } let(:user) { create(:user) } let(:followed_user) { create(:user) } diff --git a/spec/system/dashboards/user_scrolls_down_dashboard_follows_spec.rb b/spec/system/dashboards/user_scrolls_down_dashboard_follows_spec.rb index d75cf504a..eba17c82f 100644 --- a/spec/system/dashboards/user_scrolls_down_dashboard_follows_spec.rb +++ b/spec/system/dashboards/user_scrolls_down_dashboard_follows_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Infinite scroll on dashboard", type: :system, js: true do +RSpec.describe "Infinite scroll on dashboard", js: true do let(:default_per_page) { 3 } let(:total_records) { default_per_page * 2 } let(:user) { create(:user) } diff --git a/spec/system/dashboards/user_sorts_dashboard_articles_spec.rb b/spec/system/dashboards/user_sorts_dashboard_articles_spec.rb index a1403738a..bc2f2db93 100644 --- a/spec/system/dashboards/user_sorts_dashboard_articles_spec.rb +++ b/spec/system/dashboards/user_sorts_dashboard_articles_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Sorting Dashboard Articles", type: :system, js: true do +RSpec.describe "Sorting Dashboard Articles", js: true do let(:user) { create(:user) } let(:article1) do create(:article, user_id: user.id, published_at: 10.minutes.ago, created_at: 1.day.ago, public_reactions_count: 5, diff --git a/spec/system/dashboards/user_visits_dashboard_spec.rb b/spec/system/dashboards/user_visits_dashboard_spec.rb index 35640c8c0..bdc796495 100644 --- a/spec/system/dashboards/user_visits_dashboard_spec.rb +++ b/spec/system/dashboards/user_visits_dashboard_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Dashboard", type: :system, js: true do +RSpec.describe "Dashboard", js: true do let(:tag) { create(:tag) } let(:organization) { create(:organization) } let(:podcast) { create(:podcast) } diff --git a/spec/system/feedback_message_spec.rb b/spec/system/feedback_message_spec.rb index 1c2fcacd0..66ad4e0ef 100644 --- a/spec/system/feedback_message_spec.rb +++ b/spec/system/feedback_message_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Feedback report", type: :system do +RSpec.describe "Feedback report" do let(:user) { create(:user) } let(:message) { Faker::Lorem.paragraph } let(:url) { Faker::Lorem.sentence } diff --git a/spec/system/homepage/user_visits_homepage_articles_spec.rb b/spec/system/homepage/user_visits_homepage_articles_spec.rb index 678594d61..ea4e7ff62 100644 --- a/spec/system/homepage/user_visits_homepage_articles_spec.rb +++ b/spec/system/homepage/user_visits_homepage_articles_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User visits a homepage", type: :system do +RSpec.describe "User visits a homepage" do let!(:article) { create(:article, reactions_count: 12, featured: true, user: create(:user, profile_image: nil)) } let!(:article2) { create(:article, reactions_count: 20, featured: true, user: create(:user, profile_image: nil)) } # Let's use yesterday's date for this instead of relying on a magic date. diff --git a/spec/system/homepage/user_visits_homepage_spec.rb b/spec/system/homepage/user_visits_homepage_spec.rb index 1dae84a70..b5b33ec03 100644 --- a/spec/system/homepage/user_visits_homepage_spec.rb +++ b/spec/system/homepage/user_visits_homepage_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User visits a homepage", type: :system do +RSpec.describe "User visits a homepage" do let!(:ruby_tag) { create(:tag, name: "ruby") } before { create(:tag, name: "webdev") } diff --git a/spec/system/homepage/user_visits_homepage_with_announcement_spec.rb b/spec/system/homepage/user_visits_homepage_with_announcement_spec.rb index 682faa2a0..c9e3d7f57 100644 --- a/spec/system/homepage/user_visits_homepage_with_announcement_spec.rb +++ b/spec/system/homepage/user_visits_homepage_with_announcement_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User visits a homepage", type: :system do +RSpec.describe "User visits a homepage" do def expect_broadcast_data(page) within ".broadcast-wrapper" do expect(page).to have_selector(".broadcast-data") diff --git a/spec/system/link_for_tags_in_posts_in_notifications_spec.rb b/spec/system/link_for_tags_in_posts_in_notifications_spec.rb index 6c82c5479..f4f6fb8dc 100644 --- a/spec/system/link_for_tags_in_posts_in_notifications_spec.rb +++ b/spec/system/link_for_tags_in_posts_in_notifications_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Link on tags for post in notifications", type: :system do +RSpec.describe "Link on tags for post in notifications" do let(:js_tag) { create(:tag, name: "javascript") } let(:ruby_tag) { create(:tag, name: "ruby") } diff --git a/spec/system/notifications/notifications_page_spec.rb b/spec/system/notifications/notifications_page_spec.rb index 77eaf3ba5..0f778cc58 100644 --- a/spec/system/notifications/notifications_page_spec.rb +++ b/spec/system/notifications/notifications_page_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Notifications page", type: :system, js: true do +RSpec.describe "Notifications page", js: true do let(:alex) { create(:user) } let(:leslie) { create(:user) } diff --git a/spec/system/onboardings/user_completes_onboarding_spec.rb b/spec/system/onboardings/user_completes_onboarding_spec.rb index c0882e85e..952ba6425 100644 --- a/spec/system/onboardings/user_completes_onboarding_spec.rb +++ b/spec/system/onboardings/user_completes_onboarding_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Completing Onboarding", type: :system, js: true do +RSpec.describe "Completing Onboarding", js: true do let(:password) { Faker::Internet.password(min_length: 8) } let(:user) { create(:user, password: password, password_confirmation: password, saw_onboarding: false) } diff --git a/spec/system/organization/user_leaves_an_organization_spec.rb b/spec/system/organization/user_leaves_an_organization_spec.rb index 80e3e83da..fbf2fa5d5 100644 --- a/spec/system/organization/user_leaves_an_organization_spec.rb +++ b/spec/system/organization/user_leaves_an_organization_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User leaves an organization", type: :system do +RSpec.describe "User leaves an organization" do let!(:org_user) { create(:user, :org_member) } let(:organization) { org_user.organizations.first } diff --git a/spec/system/organization/user_updates_org_settings_spec.rb b/spec/system/organization/user_updates_org_settings_spec.rb index c940ed8fc..38e6578ed 100644 --- a/spec/system/organization/user_updates_org_settings_spec.rb +++ b/spec/system/organization/user_updates_org_settings_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Organization setting page(/settings/organization)", type: :system, js: true do +RSpec.describe "Organization setting page(/settings/organization)", js: true do def fill_in_org_form fill_in "organization[name]", with: "Organization Name" fill_in "organization[slug]", with: "Organization" diff --git a/spec/system/organization/user_views_an_organization_spec.rb b/spec/system/organization/user_views_an_organization_spec.rb index a961acd83..a5994b94a 100644 --- a/spec/system/organization/user_views_an_organization_spec.rb +++ b/spec/system/organization/user_views_an_organization_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Organization index", type: :system do +RSpec.describe "Organization index" do let!(:org_user) { create(:user, :org_member) } let(:organization) { org_user.organizations.first } diff --git a/spec/system/podcasts/user_visits_podcast_episode_spec.rb b/spec/system/podcasts/user_visits_podcast_episode_spec.rb index d60521f51..c8374fa7f 100644 --- a/spec/system/podcasts/user_visits_podcast_episode_spec.rb +++ b/spec/system/podcasts/user_visits_podcast_episode_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User visits podcast show page", type: :system, js: true do +RSpec.describe "User visits podcast show page", js: true do let(:podcast) { create(:podcast) } let(:podcast_episode) { create(:podcast_episode, podcast_id: podcast.id) } let(:single_quote_episode) { create(:podcast_episode, title: "What's up doc?!") } @@ -24,8 +24,8 @@ RSpec.describe "User visits podcast show page", type: :system, js: true do it "see the new comment box on the page" do visit podcast_episode.path.to_s expect(page).to have_css "form#new_comment" - expect(find("#comment_commentable_type", visible: :hidden).value).to eq("PodcastEpisode") - expect(find("#comment_commentable_id", visible: :hidden).value).to eq(podcast_episode.id.to_s) + expect(find_by_id("comment_commentable_type", visible: :hidden).value).to eq("PodcastEpisode") + expect(find_by_id("comment_commentable_id", visible: :hidden).value).to eq(podcast_episode.id.to_s) end context "when mobile apps read the podcast episode metadata" do diff --git a/spec/system/podcasts/user_visits_podcast_page_spec.rb b/spec/system/podcasts/user_visits_podcast_page_spec.rb index 53ce9ea82..46ac221fc 100644 --- a/spec/system/podcasts/user_visits_podcast_page_spec.rb +++ b/spec/system/podcasts/user_visits_podcast_page_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User visits a podcast page", type: :system do +RSpec.describe "User visits a podcast page" do let(:podcast) { create(:podcast) } let!(:podcast_episode1) { create(:podcast_episode, podcast_id: podcast.id, published_at: 2.hours.ago) } let!(:podcast_episode2) { create(:podcast_episode, podcast_id: podcast.id) } diff --git a/spec/system/podcasts/user_visits_podcasts_root_page_spec.rb b/spec/system/podcasts/user_visits_podcasts_root_page_spec.rb index 74c4607c1..314d5ba7a 100644 --- a/spec/system/podcasts/user_visits_podcasts_root_page_spec.rb +++ b/spec/system/podcasts/user_visits_podcasts_root_page_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User visits /pod page", type: :system do +RSpec.describe "User visits /pod page" do let!(:podcast_episode1) { create(:podcast_episode, published_at: 7.hours.ago) } let!(:podcast_episode2) { create(:podcast_episode, published_at: 7.days.ago) } let!(:podcast_episode3) { create(:podcast_episode) } diff --git a/spec/system/search/display_articles_search_spec.rb b/spec/system/search/display_articles_search_spec.rb index 4d5c33134..f17bcc816 100644 --- a/spec/system/search/display_articles_search_spec.rb +++ b/spec/system/search/display_articles_search_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Display articles search spec", type: :system, js: true do +RSpec.describe "Display articles search spec", js: true do it "returns correct results for a search" do found_article_one = create(:article) found_article_one.update_columns(cached_tag_list: "ruby") diff --git a/spec/system/search/display_comments_search_spec.rb b/spec/system/search/display_comments_search_spec.rb index 37e850aea..7a79c7044 100644 --- a/spec/system/search/display_comments_search_spec.rb +++ b/spec/system/search/display_comments_search_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Display articles search spec", type: :system, js: true do +RSpec.describe "Display articles search spec", js: true do it "returns correct results for a search" do query = "XSS" create(:comment, body_markdown: query) diff --git a/spec/system/search/display_users_search_spec.rb b/spec/system/search/display_users_search_spec.rb index 273e13304..4830044e5 100644 --- a/spec/system/search/display_users_search_spec.rb +++ b/spec/system/search/display_users_search_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Display users search spec", type: :system, js: true do +RSpec.describe "Display users search spec", js: true do let(:current_user) { create(:user, username: "ironman", name: "Iron Man") } let(:found_user) { create(:user, username: "janedoe", name: "Jane Doe") } let(:found_two_user) { create(:user, username: "doejane", name: "Doe Jane") } diff --git a/spec/system/search/search_title_spec.rb b/spec/system/search/search_title_spec.rb index 67bd24732..4442c406f 100644 --- a/spec/system/search/search_title_spec.rb +++ b/spec/system/search/search_title_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Search page title", type: :system do +RSpec.describe "Search page title" do let!(:current_user) { create(:user) } before do diff --git a/spec/system/search/user_searches_users_spec.rb b/spec/system/search/user_searches_users_spec.rb index 5005a929f..15a3c9f89 100644 --- a/spec/system/search/user_searches_users_spec.rb +++ b/spec/system/search/user_searches_users_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User searches users", type: :system do +RSpec.describe "User searches users" do let(:current_user) { create(:user) } let(:followed_user) { create(:user) } let(:not_followed_user) { create(:user) } diff --git a/spec/system/tags/user_updates_a_tag_spec.rb b/spec/system/tags/user_updates_a_tag_spec.rb index 0528427b9..f799c7298 100644 --- a/spec/system/tags/user_updates_a_tag_spec.rb +++ b/spec/system/tags/user_updates_a_tag_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User updates a tag", type: :system do +RSpec.describe "User updates a tag" do let(:super_admin) { create(:user, :super_admin) } let(:tag_moderator) { create(:user) } let(:bg_color_hex) { "#000000" } diff --git a/spec/system/user/trusted_user_flags_user_spec.rb b/spec/system/user/trusted_user_flags_user_spec.rb index 5db7fe577..34aa31b8d 100644 --- a/spec/system/user/trusted_user_flags_user_spec.rb +++ b/spec/system/user/trusted_user_flags_user_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" -RSpec.describe "Flagging users from profile pages", type: :system, js: true do - let(:user) { create :user } +RSpec.describe "Flagging users from profile pages", js: true do + let(:user) { create(:user) } let(:unflag_text) { "Unflag @#{user.username}" } let(:flag_text) { "Flag @#{user.username}" } diff --git a/spec/system/user/user_edits_customization_spec.rb b/spec/system/user/user_edits_customization_spec.rb index cd0bd0c72..fa3dd40c1 100644 --- a/spec/system/user/user_edits_customization_spec.rb +++ b/spec/system/user/user_edits_customization_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User edits their Customization settings", type: :system do +RSpec.describe "User edits their Customization settings" do let(:user) { create(:user) } before do diff --git a/spec/system/user/user_edits_extensions_spec.rb b/spec/system/user/user_edits_extensions_spec.rb index a01a1692b..1e2ddace3 100644 --- a/spec/system/user/user_edits_extensions_spec.rb +++ b/spec/system/user/user_edits_extensions_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User edits their extensions", type: :system, js: true do +RSpec.describe "User edits their extensions", js: true do let(:user) { create(:user) } let(:github_response_body) do [ diff --git a/spec/system/user/user_edits_profile_spec.rb b/spec/system/user/user_edits_profile_spec.rb index 924e4032d..e2ddbadd8 100644 --- a/spec/system/user/user_edits_profile_spec.rb +++ b/spec/system/user/user_edits_profile_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User edits their profile", type: :system do +RSpec.describe "User edits their profile" do let(:user) { create(:user) } let!(:profile_field_group) { create(:profile_field_group, name: "Ice Cream") } let!(:left_sidebar_profile_field) do diff --git a/spec/system/user/user_self_destroy_spec.rb b/spec/system/user/user_self_destroy_spec.rb index 8c014044b..e8e69ce1e 100644 --- a/spec/system/user/user_self_destroy_spec.rb +++ b/spec/system/user/user_self_destroy_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User destroys their profile", type: :system, js: true do +RSpec.describe "User destroys their profile", js: true do let(:user) { create(:user) } let(:token) { SecureRandom.hex(10) } let(:mismatch_token) { SecureRandom.hex(10) } diff --git a/spec/system/user/user_settings_response_templates_spec.rb b/spec/system/user/user_settings_response_templates_spec.rb index dea7f17fa..24001dcb0 100644 --- a/spec/system/user/user_settings_response_templates_spec.rb +++ b/spec/system/user/user_settings_response_templates_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User uses response templates settings", type: :system do +RSpec.describe "User uses response templates settings" do let(:user) { create(:user) } let(:response_template) { create(:response_template, user: user) } diff --git a/spec/system/user/view_user_comments_spec.rb b/spec/system/user/view_user_comments_spec.rb index b55503e40..89f267eca 100644 --- a/spec/system/user/view_user_comments_spec.rb +++ b/spec/system/user/view_user_comments_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User comments", type: :system do +RSpec.describe "User comments" do let!(:user) { create(:user, username: "user3000") } let!(:article) { create(:article, user: user) } let!(:comment) { create(:comment, user: user, commentable: create(:article)) } diff --git a/spec/system/user/view_user_index_spec.rb b/spec/system/user/view_user_index_spec.rb index 458a5f42a..2ec55fb0e 100644 --- a/spec/system/user/view_user_index_spec.rb +++ b/spec/system/user/view_user_index_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User index", type: :system do +RSpec.describe "User index" do let!(:user) { create(:user) } let!(:article) { create(:article, user: user) } let!(:other_article) { create(:article) } diff --git a/spec/system/user_uses_the_editor_spec.rb b/spec/system/user_uses_the_editor_spec.rb index 116f93f27..23543a8cf 100644 --- a/spec/system/user_uses_the_editor_spec.rb +++ b/spec/system/user_uses_the_editor_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Using the editor", type: :system do +RSpec.describe "Using the editor" do let(:user) { create(:user) } let(:raw_text) { "../support/fixtures/sample_article_template_spec.txt" } # what are these @@ -100,7 +100,7 @@ RSpec.describe "Using the editor", type: :system do visit "/new" within "form#article-form" do fill_in "article-form-title", with: "This is a test" - find("#tag-input").native.send_keys("what", :return) + find_by_id("tag-input").native.send_keys("what", :return) fill_in "article_body_markdown", with: "Hello" end click_button "Publish" diff --git a/spec/system/user_views_a_reading_list_spec.rb b/spec/system/user_views_a_reading_list_spec.rb index 0c7c4e54e..ea332d2ac 100644 --- a/spec/system/user_views_a_reading_list_spec.rb +++ b/spec/system/user_views_a_reading_list_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Reading list", type: :system do +RSpec.describe "Reading list" do let!(:user) { create(:user) } before do diff --git a/spec/system/user_views_logo_spec.rb b/spec/system/user_views_logo_spec.rb index 9060bf16f..c62442cc0 100644 --- a/spec/system/user_views_logo_spec.rb +++ b/spec/system/user_views_logo_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Logo behaviour", type: :system do +RSpec.describe "Logo behaviour" do let!(:user) { create(:user) } let(:resized_logo) { "default.png" } diff --git a/spec/system/user_visits_a_comments_page_spec.rb b/spec/system/user_visits_a_comments_page_spec.rb index 6263e58e0..95a16fbfc 100644 --- a/spec/system/user_visits_a_comments_page_spec.rb +++ b/spec/system/user_visits_a_comments_page_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "Views an article", type: :system, js: true do +RSpec.describe "Views an article", js: true do let(:user) { create(:user) } let(:co_author) { create(:user) } let(:article) { create(:article, user: user, co_author_ids: [co_author.id]) } diff --git a/spec/system/videos/user_visits_videos_spec.rb b/spec/system/videos/user_visits_videos_spec.rb index bd17f0d2e..895f6ed56 100644 --- a/spec/system/videos/user_visits_videos_spec.rb +++ b/spec/system/videos/user_visits_videos_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "User visits the videos page", type: :system do +RSpec.describe "User visits the videos page" do context "when user hasn't logged in" do before { visit "/videos" } diff --git a/spec/view_objects/cloud_cover_url_spec.rb b/spec/view_objects/cloud_cover_url_spec.rb index b821eeb11..9c67ad5c9 100644 --- a/spec/view_objects/cloud_cover_url_spec.rb +++ b/spec/view_objects/cloud_cover_url_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe CloudCoverUrl, type: :view_object, cloudinary: true do +RSpec.describe CloudCoverUrl, cloudinary: true, type: :view_object do let(:article) { create(:article, main_image: "https://robohash.org/articlefactory.png") } let(:cloudinary_prefix) { "https://res.cloudinary.com/#{Cloudinary.config.cloud_name}/image/fetch/" } diff --git a/spec/views/articles_spec.rb b/spec/views/articles_spec.rb index b8234ab3f..744a804e2 100644 --- a/spec/views/articles_spec.rb +++ b/spec/views/articles_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "articles/show", type: :view do +RSpec.describe "articles/show" do let(:user1) { create(:user) } let(:article1) { create(:article, user_id: user1.id, show_comments: true) } let(:helper) { Class.new { extend CommentsHelper } } diff --git a/spec/views/comments/_comment.html.erb_spec.rb b/spec/views/comments/_comment.html.erb_spec.rb index 33c0867fd..9457a2fd2 100644 --- a/spec/views/comments/_comment.html.erb_spec.rb +++ b/spec/views/comments/_comment.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "rendering locals in a partial", type: :view do +RSpec.describe "rendering locals in a partial" do context "when comment is low-quality" do it "renders the comment with low-quality marker" do allow(Settings::General).to receive(:mascot_image_url).and_return("https://i.imgur.com/fKYKgo4.png") diff --git a/spec/views/credits/new.html.erb_spec.rb b/spec/views/credits/new.html.erb_spec.rb index 133132946..d5ca5dcd1 100644 --- a/spec/views/credits/new.html.erb_spec.rb +++ b/spec/views/credits/new.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "credits/new", type: :view do +RSpec.describe "credits/new" do let(:purchaser) { create(:user) } let(:credit) { build(:credit) } diff --git a/spec/views/dashboards/show.html.erb_spec.rb b/spec/views/dashboards/show.html.erb_spec.rb index 16ba472bb..746582b60 100644 --- a/spec/views/dashboards/show.html.erb_spec.rb +++ b/spec/views/dashboards/show.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "dashboards/show", type: :view do +RSpec.describe "dashboards/show" do before do stub_template "dashboards/_actions_mobile.html.erb" => "stubbed content" stub_template "dashboards/_analytics.html.erb" => "stubbed content" diff --git a/spec/views/email_subscriptions/unsubscribe.html.erb_spec.rb b/spec/views/email_subscriptions/unsubscribe.html.erb_spec.rb index 7e764ce48..463cd19aa 100644 --- a/spec/views/email_subscriptions/unsubscribe.html.erb_spec.rb +++ b/spec/views/email_subscriptions/unsubscribe.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "email_subscriptions/unsubscribe", type: :view do +RSpec.describe "email_subscriptions/unsubscribe" do it "works" do assign(:email_type, "#{Settings::Community.community_name} digest emails") render diff --git a/spec/views/layouts/signup_modal.html.erb_spec.rb b/spec/views/layouts/signup_modal.html.erb_spec.rb index ab2311247..af8986a40 100644 --- a/spec/views/layouts/signup_modal.html.erb_spec.rb +++ b/spec/views/layouts/signup_modal.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "layouts/_signup_modal", type: :view do +RSpec.describe "layouts/_signup_modal" do let(:tagline_text) { "the best community" } it "renders the tagline if it is set" do diff --git a/spec/views/podcast_episodes/index.html.erb_spec.rb b/spec/views/podcast_episodes/index.html.erb_spec.rb index 161a1f748..45cdff226 100644 --- a/spec/views/podcast_episodes/index.html.erb_spec.rb +++ b/spec/views/podcast_episodes/index.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "podcast_episodes/index", type: :view do +RSpec.describe "podcast_episodes/index" do let(:podcast) { create(:podcast) } let(:podcast_episodes) { create_list(:podcast_episode, 5, podcast: podcast) } diff --git a/spec/views/stories/sign_in_invitation.html.erb_spec.rb b/spec/views/stories/sign_in_invitation.html.erb_spec.rb index f37948bc8..1ae197a80 100644 --- a/spec/views/stories/sign_in_invitation.html.erb_spec.rb +++ b/spec/views/stories/sign_in_invitation.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "stories/_sign_in_invitation", type: :view do +RSpec.describe "stories/_sign_in_invitation" do it "has the community member label" do render expect(rendered).to have_text(Settings::Community.member_label.pluralize) diff --git a/spec/views/users/settings_spec.rb b/spec/views/users/settings_spec.rb index c874b8d38..0222c37b1 100644 --- a/spec/views/users/settings_spec.rb +++ b/spec/views/users/settings_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe "users/edit", type: :view do +RSpec.describe "users/edit" do let(:user) { create(:user) } let(:org) { create(:organization) } diff --git a/spec/workers/feeds/import_articles_worker_spec.rb b/spec/workers/feeds/import_articles_worker_spec.rb index 1a8d72b80..5fb68732f 100644 --- a/spec/workers/feeds/import_articles_worker_spec.rb +++ b/spec/workers/feeds/import_articles_worker_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Feeds::ImportArticlesWorker, type: :worker, sidekiq: :inline do +RSpec.describe Feeds::ImportArticlesWorker, sidekiq: :inline, type: :worker do let(:worker) { subject } let(:feed_url) { "https://medium.com/feed/@vaidehijoshi" } diff --git a/spec/workers/reactions/update_relevant_scores_worker_spec.rb b/spec/workers/reactions/update_relevant_scores_worker_spec.rb index 3c5a266af..f1798615a 100644 --- a/spec/workers/reactions/update_relevant_scores_worker_spec.rb +++ b/spec/workers/reactions/update_relevant_scores_worker_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Reactions::UpdateRelevantScoresWorker, type: :worker, throttled_call: true do +RSpec.describe Reactions::UpdateRelevantScoresWorker, throttled_call: true, type: :worker do describe "#perform" do let(:article) { create(:article) } let(:reaction) { create(:reaction, reactable: article) }