diff --git a/Gemfile.lock b/Gemfile.lock index 533e3487b84..cb8558e7c3a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GIT GIT remote: https://github.com/discourse/rubocop-discourse.git - revision: e44784b759aef45306b0eaee29ddadd8ca5b40a6 + revision: 5afeae107d3c003bf5bcf75457501ee7c1248fd2 specs: rubocop-discourse (2.5.0) rubocop (>= 1.1.0) diff --git a/spec/import_export/category_exporter_spec.rb b/spec/import_export/category_exporter_spec.rb index 91af5c5b4aa..6f943d69376 100644 --- a/spec/import_export/category_exporter_spec.rb +++ b/spec/import_export/category_exporter_spec.rb @@ -14,7 +14,7 @@ describe ImportExport::CategoryExporter do STDOUT.stubs(:write) end - context '.perform' do + describe '.perform' do it 'export the category when it is found' do data = ImportExport::CategoryExporter.new([category.id]).perform.export_data diff --git a/spec/import_export/importer_spec.rb b/spec/import_export/importer_spec.rb index 78c52eccb7a..217c68da570 100644 --- a/spec/import_export/importer_spec.rb +++ b/spec/import_export/importer_spec.rb @@ -17,7 +17,7 @@ describe ImportExport::Importer do ImportExport::Importer.new(data).perform end - context '.perform' do + describe '.perform' do it 'topics and users' do data = import_data.dup diff --git a/spec/import_export/topic_exporter_spec.rb b/spec/import_export/topic_exporter_spec.rb index ba3cf17f386..bf10d59d7f6 100644 --- a/spec/import_export/topic_exporter_spec.rb +++ b/spec/import_export/topic_exporter_spec.rb @@ -12,7 +12,7 @@ describe ImportExport::TopicExporter do fab!(:topic) { Fabricate(:topic, user: user) } fab!(:post) { Fabricate(:post, topic: topic, user: user) } - context '.perform' do + describe '.perform' do it 'export a single topic' do data = ImportExport::TopicExporter.new([topic.id]).perform.export_data diff --git a/spec/jobs/clean_dismissed_topic_users_spec.rb b/spec/jobs/clean_dismissed_topic_users_spec.rb index eb7c03560d1..b74a534043a 100644 --- a/spec/jobs/clean_dismissed_topic_users_spec.rb +++ b/spec/jobs/clean_dismissed_topic_users_spec.rb @@ -5,7 +5,7 @@ describe Jobs::CleanDismissedTopicUsers do fab!(:topic) { Fabricate(:topic, created_at: 5.hours.ago) } fab!(:dismissed_topic_user) { Fabricate(:dismissed_topic_user, user: user, topic: topic) } - context '#delete_overdue_dismissals!' do + describe '#delete_overdue_dismissals!' do it 'does not delete when new_topic_duration_minutes is set to always' do user.user_option.update(new_topic_duration_minutes: User::NewTopicDuration::ALWAYS) expect { described_class.new.execute({}) }.not_to change { DismissedTopicUser.count } @@ -28,7 +28,7 @@ describe Jobs::CleanDismissedTopicUsers do end end - context '#delete_over_the_limit_dismissals!' do + describe '#delete_over_the_limit_dismissals!' do fab!(:user2) { Fabricate(:user, created_at: 1.days.ago, previous_visit_at: 1.days.ago) } fab!(:topic2) { Fabricate(:topic, created_at: 6.hours.ago) } fab!(:topic3) { Fabricate(:topic, created_at: 2.hours.ago) } diff --git a/spec/jobs/disable_bootstrap_mode_spec.rb b/spec/jobs/disable_bootstrap_mode_spec.rb index 82f9447f72d..1b9e1cfb7df 100644 --- a/spec/jobs/disable_bootstrap_mode_spec.rb +++ b/spec/jobs/disable_bootstrap_mode_spec.rb @@ -2,7 +2,7 @@ describe Jobs::DisableBootstrapMode do - context '.execute' do + describe '.execute' do fab!(:admin) { Fabricate(:admin) } before do diff --git a/spec/jobs/enable_bootstrap_mode_spec.rb b/spec/jobs/enable_bootstrap_mode_spec.rb index ec8145eda92..29a2284862b 100644 --- a/spec/jobs/enable_bootstrap_mode_spec.rb +++ b/spec/jobs/enable_bootstrap_mode_spec.rb @@ -2,7 +2,7 @@ describe Jobs::EnableBootstrapMode do - context '.execute' do + describe '.execute' do fab!(:admin) { Fabricate(:admin) } before do diff --git a/spec/jobs/export_csv_file_spec.rb b/spec/jobs/export_csv_file_spec.rb index ce51cfe5dd2..9b6fcb8b030 100644 --- a/spec/jobs/export_csv_file_spec.rb +++ b/spec/jobs/export_csv_file_spec.rb @@ -2,7 +2,7 @@ describe Jobs::ExportCsvFile do - context '#execute' do + describe '#execute' do let(:other_user) { Fabricate(:user) } let(:admin) { Fabricate(:admin) } let(:action_log) { StaffActionLogger.new(admin).log_revoke_moderation(other_user) } @@ -51,7 +51,7 @@ describe Jobs::ExportCsvFile do end end - context '.report_export' do + describe '.report_export' do let(:user) { Fabricate(:admin) } diff --git a/spec/jobs/export_user_archive_spec.rb b/spec/jobs/export_user_archive_spec.rb index 42fb4f2fdec..234d26697d8 100644 --- a/spec/jobs/export_user_archive_spec.rb +++ b/spec/jobs/export_user_archive_spec.rb @@ -36,7 +36,7 @@ describe Jobs::ExportUserArchive do JSON.parse(MultiJson.dump(job.public_send(:"#{component}_export"))) end - context '#execute' do + describe '#execute' do before do _ = post user.user_profile.website = 'https://doe.example.com/john' diff --git a/spec/jobs/invite_email_spec.rb b/spec/jobs/invite_email_spec.rb index c0c2c9587ce..e494f327ee5 100644 --- a/spec/jobs/invite_email_spec.rb +++ b/spec/jobs/invite_email_spec.rb @@ -2,7 +2,7 @@ describe Jobs::InviteEmail do - context '.execute' do + describe '.execute' do it 'raises an error when the invite_id is missing' do expect { Jobs::InviteEmail.new.execute({}) }.to raise_error(Discourse::InvalidParameters) diff --git a/spec/jobs/process_post_spec.rb b/spec/jobs/process_post_spec.rb index 0fb49e684b9..ddcfe663551 100644 --- a/spec/jobs/process_post_spec.rb +++ b/spec/jobs/process_post_spec.rb @@ -89,7 +89,7 @@ describe Jobs::ProcessPost do end end - context "#enqueue_pull_hotlinked_images" do + describe "#enqueue_pull_hotlinked_images" do fab!(:post) { Fabricate(:post, created_at: 20.days.ago) } let(:job) { Jobs::ProcessPost.new } diff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rb index c44f00f95e0..a9cfeeec453 100644 --- a/spec/jobs/pull_hotlinked_images_spec.rb +++ b/spec/jobs/pull_hotlinked_images_spec.rb @@ -592,7 +592,7 @@ describe Jobs::PullHotlinkedImages do end end - context "#disable_if_low_on_disk_space" do + describe "#disable_if_low_on_disk_space" do fab!(:post) { Fabricate(:post, created_at: 20.days.ago) } let(:job) { Jobs::PullHotlinkedImages.new } diff --git a/spec/lib/composer_messages_finder_spec.rb b/spec/lib/composer_messages_finder_spec.rb index 6830d6cc944..735614bf740 100644 --- a/spec/lib/composer_messages_finder_spec.rb +++ b/spec/lib/composer_messages_finder_spec.rb @@ -22,7 +22,7 @@ describe ComposerMessagesFinder do end - context '.check_education_message' do + describe '.check_education_message' do let(:user) { Fabricate.build(:user) } context 'creating topic' do @@ -82,7 +82,7 @@ describe ComposerMessagesFinder do end end - context '.check_new_user_many_replies' do + describe '.check_new_user_many_replies' do let(:user) { Fabricate.build(:user) } context 'replying' do @@ -101,7 +101,7 @@ describe ComposerMessagesFinder do end - context '.check_avatar_notification' do + describe '.check_avatar_notification' do let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'createTopic') } fab!(:user) { Fabricate(:user) } @@ -148,7 +148,7 @@ describe ComposerMessagesFinder do end end - context '.check_sequential_replies' do + describe '.check_sequential_replies' do fab!(:user) { Fabricate(:user) } fab!(:topic) { Fabricate(:topic) } @@ -223,7 +223,7 @@ describe ComposerMessagesFinder do end - context '.check_dominating_topic' do + describe '.check_dominating_topic' do fab!(:user) { Fabricate(:user) } fab!(:topic) { Fabricate(:topic) } @@ -308,7 +308,7 @@ describe ComposerMessagesFinder do end - context '.check_get_a_room' do + describe '.check_get_a_room' do fab!(:user) { Fabricate(:user) } fab!(:other_user) { Fabricate(:user) } fab!(:third_user) { Fabricate(:user) } @@ -431,7 +431,7 @@ describe ComposerMessagesFinder do end - context '.check_reviving_old_topic' do + describe '.check_reviving_old_topic' do fab!(:user) { Fabricate(:user) } fab!(:topic) { Fabricate(:topic) } diff --git a/spec/lib/cooked_post_processor_spec.rb b/spec/lib/cooked_post_processor_spec.rb index 4215f72eb83..9f327dd9862 100644 --- a/spec/lib/cooked_post_processor_spec.rb +++ b/spec/lib/cooked_post_processor_spec.rb @@ -7,7 +7,7 @@ describe CookedPostProcessor do fab!(:upload) { Fabricate(:upload) } let(:upload_path) { Discourse.store.upload_path } - context "#post_process" do + describe "#post_process" do fab!(:post) do Fabricate(:post, raw: <<~RAW) @@ -837,7 +837,7 @@ describe CookedPostProcessor do end end - context "#extract_images" do + describe "#extract_images" do let(:post) { build(:post_with_plenty_of_images) } let(:cpp) { CookedPostProcessor.new(post) } @@ -848,7 +848,7 @@ describe CookedPostProcessor do end - context "#get_size_from_attributes" do + describe "#get_size_from_attributes" do let(:post) { build(:post) } let(:cpp) { CookedPostProcessor.new(post) } @@ -882,7 +882,7 @@ describe CookedPostProcessor do end - context "#get_size_from_image_sizes" do + describe "#get_size_from_image_sizes" do let(:post) { build(:post) } let(:cpp) { CookedPostProcessor.new(post) } @@ -894,7 +894,7 @@ describe CookedPostProcessor do end - context "#get_size" do + describe "#get_size" do let(:post) { build(:post) } let(:cpp) { CookedPostProcessor.new(post) } @@ -916,7 +916,7 @@ describe CookedPostProcessor do end end - context "#is_valid_image_url?" do + describe "#is_valid_image_url?" do let(:post) { build(:post) } let(:cpp) { CookedPostProcessor.new(post) } @@ -939,7 +939,7 @@ describe CookedPostProcessor do end - context "#get_filename" do + describe "#get_filename" do let(:post) { build(:post) } let(:cpp) { CookedPostProcessor.new(post) } @@ -960,7 +960,7 @@ describe CookedPostProcessor do end - context "#convert_to_link" do + describe "#convert_to_link" do fab!(:thumbnail) { Fabricate(:optimized_image, upload: upload, width: 512, height: 384) } before do @@ -1051,7 +1051,7 @@ describe CookedPostProcessor do end end - context "#post_process_oneboxes" do + describe "#post_process_oneboxes" do let(:post) { build(:post_with_youtube, id: 123) } let(:cpp) { CookedPostProcessor.new(post, invalidate_oneboxes: true) } @@ -1161,7 +1161,7 @@ describe CookedPostProcessor do end end - context "#post_process_oneboxes removes nofollow if add_rel_nofollow_to_user_content is disabled" do + describe "#post_process_oneboxes removes nofollow if add_rel_nofollow_to_user_content is disabled" do let(:post) { build(:post_with_youtube, id: 123) } let(:cpp) { CookedPostProcessor.new(post, invalidate_oneboxes: true) } @@ -1179,7 +1179,7 @@ describe CookedPostProcessor do end end - context "#post_process_oneboxes removes nofollow if user is tl3" do + describe "#post_process_oneboxes removes nofollow if user is tl3" do let(:post) { build(:post_with_youtube, id: 123) } let(:cpp) { CookedPostProcessor.new(post, invalidate_oneboxes: true) } @@ -1200,7 +1200,7 @@ describe CookedPostProcessor do end end - context "#post_process_oneboxes with oneboxed image" do + describe "#post_process_oneboxes with oneboxed image" do let(:post) { build(:post_with_youtube, id: 123) } let(:cpp) { CookedPostProcessor.new(post, invalidate_oneboxes: true) } @@ -1225,7 +1225,7 @@ describe CookedPostProcessor do end end - context "#post_process_oneboxes with square image" do + describe "#post_process_oneboxes with square image" do it "generates a onebox-avatar class" do url = 'https://square-image.com/onebox' @@ -1259,7 +1259,7 @@ describe CookedPostProcessor do end - context "#optimize_urls" do + describe "#optimize_urls" do let(:post) { build(:post_with_uploads_and_links) } let(:cpp) { CookedPostProcessor.new(post) } @@ -1515,7 +1515,7 @@ describe CookedPostProcessor do end - context "#remove_user_ids" do + describe "#remove_user_ids" do let(:topic) { Fabricate(:topic) } let(:post) do @@ -1542,7 +1542,7 @@ describe CookedPostProcessor do end end - context "#is_a_hyperlink?" do + describe "#is_a_hyperlink?" do let(:post) { build(:post) } let(:cpp) { CookedPostProcessor.new(post) } @@ -1958,7 +1958,7 @@ describe CookedPostProcessor do end end - context "#html" do + describe "#html" do it "escapes attributes" do post = Fabricate(:post, raw: '') expect(post.cook(post.raw)).to eq('
') diff --git a/spec/lib/discourse_event_spec.rb b/spec/lib/discourse_event_spec.rb index fbc916a608c..ee7a0c73e9f 100644 --- a/spec/lib/discourse_event_spec.rb +++ b/spec/lib/discourse_event_spec.rb @@ -83,7 +83,7 @@ describe DiscourseEvent do end end - context '#all_off' do + describe '#all_off' do let(:event_handler_2) do Proc.new { |user| user.job = 'Supervillain' } diff --git a/spec/lib/discourse_plugin_registry_spec.rb b/spec/lib/discourse_plugin_registry_spec.rb index f876d5272a4..a212f9bc02e 100644 --- a/spec/lib/discourse_plugin_registry_spec.rb +++ b/spec/lib/discourse_plugin_registry_spec.rb @@ -55,42 +55,42 @@ describe DiscoursePluginRegistry do end end - context '#stylesheets' do + describe '#stylesheets' do it 'defaults to an empty Set' do registry.reset! expect(registry.stylesheets).to eq(Hash.new) end end - context '#mobile_stylesheets' do + describe '#mobile_stylesheets' do it 'defaults to an empty Set' do registry.reset! expect(registry.mobile_stylesheets).to eq(Hash.new) end end - context '#javascripts' do + describe '#javascripts' do it 'defaults to an empty Set' do registry.reset! expect(registry.javascripts).to eq(Set.new) end end - context '#auth_providers' do + describe '#auth_providers' do it 'defaults to an empty Set' do registry.reset! expect(registry.auth_providers).to eq(Set.new) end end - context '#admin_javascripts' do + describe '#admin_javascripts' do it 'defaults to an empty Set' do registry.reset! expect(registry.admin_javascripts).to eq(Set.new) end end - context '#seed_data' do + describe '#seed_data' do it 'defaults to an empty Set' do registry.reset! expect(registry.seed_data).to be_a(Hash) @@ -98,7 +98,7 @@ describe DiscoursePluginRegistry do end end - context '.register_html_builder' do + describe '.register_html_builder' do it "can register and build html" do DiscoursePluginRegistry.register_html_builder(:my_html) { "my html" } expect(DiscoursePluginRegistry.build_html(:my_html)).to eq('my html') @@ -114,7 +114,7 @@ describe DiscoursePluginRegistry do end end - context '.register_css' do + describe '.register_css' do let(:plugin_directory_name) { "hello" } before do @@ -134,7 +134,7 @@ describe DiscoursePluginRegistry do end end - context '.register_js' do + describe '.register_js' do before do registry_instance.register_js('hello.js') end @@ -148,7 +148,7 @@ describe DiscoursePluginRegistry do end end - context '.register_auth_provider' do + describe '.register_auth_provider' do let(:registry) { DiscoursePluginRegistry } let(:auth_provider) do provider = Auth::AuthProvider.new @@ -170,7 +170,7 @@ describe DiscoursePluginRegistry do end - context '.register_service_worker' do + describe '.register_service_worker' do let(:registry) { DiscoursePluginRegistry } before do @@ -189,14 +189,14 @@ describe DiscoursePluginRegistry do end end - context '.register_archetype' do + describe '.register_archetype' do it "delegates archetypes to the Archetype component" do Archetype.expects(:register).with('threaded', hello: 123) registry_instance.register_archetype('threaded', hello: 123) end end - context '#register_asset' do + describe '#register_asset' do let(:registry) { DiscoursePluginRegistry } let(:plugin_directory_name) { "my_plugin" } @@ -247,7 +247,7 @@ describe DiscoursePluginRegistry do end end - context '#register_seed_data' do + describe '#register_seed_data' do let(:registry) { DiscoursePluginRegistry } after do diff --git a/spec/lib/discourse_spec.rb b/spec/lib/discourse_spec.rb index cd3a85e6520..1438789a3eb 100644 --- a/spec/lib/discourse_spec.rb +++ b/spec/lib/discourse_spec.rb @@ -177,7 +177,7 @@ describe Discourse do end end - context '#site_contact_user' do + describe '#site_contact_user' do fab!(:admin) { Fabricate(:admin) } fab!(:another_admin) { Fabricate(:admin) } @@ -194,13 +194,13 @@ describe Discourse do end - context '#system_user' do + describe '#system_user' do it 'returns the system user' do expect(Discourse.system_user.id).to eq(-1) end end - context "#store" do + describe "#store" do it "returns LocalStore by default" do expect(Discourse.store).to be_a(FileStore::LocalStore) @@ -319,7 +319,7 @@ describe Discourse do end end - context "#handle_exception" do + describe "#handle_exception" do class TempSidekiqLogger attr_accessor :exception, :context @@ -363,7 +363,7 @@ describe Discourse do end end - context '#deprecate' do + describe '#deprecate' do def old_method(m) Discourse.deprecate(m) end @@ -472,7 +472,7 @@ describe Discourse do end end - context ".clear_all_theme_cache!" do + describe ".clear_all_theme_cache!" do before do setup_s3 SiteSetting.s3_cdn_url = "https://s3.cdn.com/gg" diff --git a/spec/lib/email/receiver_spec.rb b/spec/lib/email/receiver_spec.rb index 73b0fb873d0..2a12c0d1a1c 100644 --- a/spec/lib/email/receiver_spec.rb +++ b/spec/lib/email/receiver_spec.rb @@ -1529,7 +1529,7 @@ describe Email::Receiver do end - context "#reply_by_email_address_regex" do + describe "#reply_by_email_address_regex" do before do SiteSetting.reply_by_email_address = nil @@ -1863,7 +1863,7 @@ describe Email::Receiver do expect(email.cc_addresses).to eq("bob@example.com;carol@example.com") end - context "#select_body" do + describe "#select_body" do let(:email) { <<~EMAIL diff --git a/spec/lib/inline_oneboxer_spec.rb b/spec/lib/inline_oneboxer_spec.rb index f9c33427236..456d31a3f1d 100644 --- a/spec/lib/inline_oneboxer_spec.rb +++ b/spec/lib/inline_oneboxer_spec.rb @@ -44,7 +44,7 @@ describe InlineOneboxer do end end - context ".lookup" do + describe ".lookup" do let(:category) { Fabricate(:private_category, group: Group[:staff]) } let(:category2) { Fabricate(:private_category, group: Group[:staff]) } diff --git a/spec/lib/oneboxer_spec.rb b/spec/lib/oneboxer_spec.rb index d8f6b8246b3..3bba57e0d23 100644 --- a/spec/lib/oneboxer_spec.rb +++ b/spec/lib/oneboxer_spec.rb @@ -149,7 +149,7 @@ describe Oneboxer do end end - context ".onebox_raw" do + describe ".onebox_raw" do it "should escape the onebox URL before processing" do post = Fabricate(:post, raw: Discourse.base_url + "/new?'class=black") cpp = CookedPostProcessor.new(post, invalidate_oneboxes: true) @@ -158,7 +158,7 @@ describe Oneboxer do end end - context ".external_onebox" do + describe ".external_onebox" do html = <<~HTML diff --git a/spec/lib/plugin/instance_spec.rb b/spec/lib/plugin/instance_spec.rb index c11fbc4c0c4..f30fb1026ee 100644 --- a/spec/lib/plugin/instance_spec.rb +++ b/spec/lib/plugin/instance_spec.rb @@ -162,7 +162,7 @@ describe Plugin::Instance do end end - context "#add_report" do + describe "#add_report" do it "adds a report" do plugin = Plugin::Instance.new nil, "/tmp/test.rb" plugin.add_report("readers") {} diff --git a/spec/lib/post_creator_spec.rb b/spec/lib/post_creator_spec.rb index 748cd6a2250..d59823d1cac 100644 --- a/spec/lib/post_creator_spec.rb +++ b/spec/lib/post_creator_spec.rb @@ -1793,7 +1793,7 @@ describe PostCreator do end end - context "#create_post_notice" do + describe "#create_post_notice" do fab!(:user) { Fabricate(:user) } fab!(:staged) { Fabricate(:staged) } fab!(:anonymous) { Fabricate(:anonymous) } diff --git a/spec/lib/post_revisor_spec.rb b/spec/lib/post_revisor_spec.rb index 7d0aa2183ed..49f3143ee89 100644 --- a/spec/lib/post_revisor_spec.rb +++ b/spec/lib/post_revisor_spec.rb @@ -758,7 +758,7 @@ describe PostRevisor do expect(post.post_revisions.last.modifications).to eq('tags' => [[], ['new-tag-3']]) end - context "#publish_changes" do + describe "#publish_changes" do let!(:post) { Fabricate(:post, topic: topic) } it "should publish topic changes to clients" do diff --git a/spec/lib/search_spec.rb b/spec/lib/search_spec.rb index b7ece4605a4..6135fb32c03 100644 --- a/spec/lib/search_spec.rb +++ b/spec/lib/search_spec.rb @@ -9,7 +9,7 @@ describe Search do Jobs.run_immediately! end - context "#ts_config" do + describe "#ts_config" do it "maps locales to correct Postgres dictionaries" do expect(Search.ts_config).to eq("english") expect(Search.ts_config("en")).to eq("english") @@ -20,7 +20,7 @@ describe Search do end end - context "#GroupedSearchResults.blurb_for" do + describe "#GroupedSearchResults.blurb_for" do it "strips audio and video URLs from search blurb" do cooked = <<~RAW link to an external page: https://google.com/?u=bar @@ -55,7 +55,7 @@ describe Search do end end - context "#execute" do + describe "#execute" do before do SiteSetting.tagging_enabled = true end @@ -2030,7 +2030,7 @@ describe Search do end end - context '#ts_query' do + describe '#ts_query' do it 'can parse complex strings using ts_query helper' do str = +" grigio:babel deprecated? " str << "page page on Atmosphere](https://atmospherejs.com/grigio/babel)xxx: aaa.js:222 aaa'\"bbb" @@ -2052,7 +2052,7 @@ describe Search do end end - context '#word_to_date' do + describe '#word_to_date' do it 'parses relative dates correctly' do time = Time.zone.parse('2001-02-20 2:55') freeze_time(time) @@ -2080,7 +2080,7 @@ describe Search do end end - context "#min_post_id" do + describe "#min_post_id" do it "returns 0 when prefer_recent_posts is disabled" do SiteSetting.search_prefer_recent_posts = false expect(Search.min_post_id_no_cache).to eq(0) diff --git a/spec/lib/stylesheet/importer_spec.rb b/spec/lib/stylesheet/importer_spec.rb index 27b9727f328..09c6e6701f8 100644 --- a/spec/lib/stylesheet/importer_spec.rb +++ b/spec/lib/stylesheet/importer_spec.rb @@ -8,7 +8,7 @@ describe Stylesheet::Importer do Stylesheet::Compiler.compile_asset(name)[0] end - context "#category_backgrounds" do + describe "#category_backgrounds" do it "applies CDN to background category images" do expect(compile_css("color_definitions")).to_not include("body.category-") @@ -37,7 +37,7 @@ describe Stylesheet::Importer do end - context "#font" do + describe "#font" do it "includes font variable" do default_font = ":root{--font-family: Arial, sans-serif}" expect(compile_css("color_definitions")).to include(default_font) @@ -76,7 +76,7 @@ describe Stylesheet::Importer do end end - context "#import_color_definitions" do + describe "#import_color_definitions" do let(:scss) { ":root{--custom-color: green}" } let(:scss_child) { "$navy: #000080; :root{--custom-color: red; --custom-color-rgb: \#{hexToRGB($navy)}}" } @@ -115,7 +115,7 @@ describe Stylesheet::Importer do end end - context "#import_wcag_overrides" do + describe "#import_wcag_overrides" do it "should do nothing on a regular scheme" do scheme = ColorScheme.create_from_base(name: 'Regular') expect(Stylesheet::Importer.new({ color_scheme_id: scheme.id }).import_wcag_overrides).to eq("") diff --git a/spec/lib/system_message_spec.rb b/spec/lib/system_message_spec.rb index 0c1b73a1a23..9427773e875 100644 --- a/spec/lib/system_message_spec.rb +++ b/spec/lib/system_message_spec.rb @@ -5,7 +5,7 @@ require 'topic_subtype' describe SystemMessage do - context '#create' do + describe '#create' do fab!(:admin) { Fabricate(:admin) } fab!(:user) { Fabricate(:user) } diff --git a/spec/lib/theme_store/git_importer_spec.rb b/spec/lib/theme_store/git_importer_spec.rb index 78f6ce0e4db..0216edcd5b4 100644 --- a/spec/lib/theme_store/git_importer_spec.rb +++ b/spec/lib/theme_store/git_importer_spec.rb @@ -6,7 +6,7 @@ require 'theme_store/git_importer' describe ThemeStore::GitImporter do - context "#import" do + describe "#import" do let(:url) { "https://github.com/example/example.git" } let(:trailing_slash_url) { "https://github.com/example/example/" } diff --git a/spec/lib/topic_query_spec.rb b/spec/lib/topic_query_spec.rb index e1c93d0972d..d585ff3c15f 100644 --- a/spec/lib/topic_query_spec.rb +++ b/spec/lib/topic_query_spec.rb @@ -65,7 +65,7 @@ describe TopicQuery do end end - context "#list_topics_by" do + describe "#list_topics_by" do it "allows users to view their own invisible topics" do _topic = Fabricate(:topic, user: user) @@ -77,7 +77,7 @@ describe TopicQuery do end - context "#prioritize_pinned_topics" do + describe "#prioritize_pinned_topics" do it "does the pagination correctly" do num_topics = 15 per_page = 3 @@ -503,7 +503,7 @@ describe TopicQuery do end end - context "#list_top_for" do + describe "#list_top_for" do it "lists top for the week" do Fabricate(:topic, like_count: 1000, posts_count: 100) TopTopic.refresh! @@ -892,7 +892,7 @@ describe TopicQuery do end - context '#list_new' do + describe '#list_new' do context 'without a new topic' do it "has no new topics" do @@ -969,7 +969,7 @@ describe TopicQuery do end - context '#list_posted' do + describe '#list_posted' do let(:topics) { topic_query.list_posted.topics } it "returns blank when there are no posted topics" do @@ -1023,7 +1023,7 @@ describe TopicQuery do end end - context '#list_unseen' do + describe '#list_unseen' do it "returns an empty list when there aren't topics" do expect(topic_query.list_unseen.topics).to be_blank end @@ -1074,7 +1074,7 @@ describe TopicQuery do end end - context '#list_related_for' do + describe '#list_related_for' do let(:user) do Fabricate(:admin) diff --git a/spec/lib/topic_view_spec.rb b/spec/lib/topic_view_spec.rb index e30746fb36e..6f0d94d71e6 100644 --- a/spec/lib/topic_view_spec.rb +++ b/spec/lib/topic_view_spec.rb @@ -341,7 +341,7 @@ RSpec.describe TopicView do end end - context '.post_counts_by_user' do + describe '.post_counts_by_user' do it 'returns the two posters with their appropriate counts' do SiteSetting.enable_whispers = true Fabricate(:post, topic: topic, user: evil_trout, post_type: Post.types[:whisper]) @@ -361,13 +361,13 @@ RSpec.describe TopicView do end end - context '.participants' do + describe '.participants' do it 'returns the two participants hashed by id' do expect(topic_view.participants.to_a).to match_array([[first_poster.id, first_poster], [evil_trout.id, evil_trout]]) end end - context '.all_post_actions' do + describe '.all_post_actions' do it 'is blank at first' do expect(topic_view.all_post_actions).to be_blank end @@ -378,7 +378,7 @@ RSpec.describe TopicView do end end - context '.read?' do + describe '.read?' do it 'tracks correctly' do # anon is assumed to have read everything expect(TopicView.new(topic.id).read?(1)).to eq(true) @@ -395,7 +395,7 @@ RSpec.describe TopicView do end end - context "#bookmarks" do + describe "#bookmarks" do let!(:user) { Fabricate(:user) } let!(:bookmark1) { Fabricate(:bookmark, bookmarkable: Fabricate(:post, topic: topic), user: user) } let!(:bookmark2) { Fabricate(:bookmark, bookmarkable: Fabricate(:post, topic: topic), user: user) } @@ -412,7 +412,7 @@ RSpec.describe TopicView do end end - context "#bookmarks" do + describe "#bookmarks" do let!(:user) { Fabricate(:user) } let!(:bookmark1) { Fabricate(:bookmark_next_business_day_reminder, bookmarkable: topic.first_post, user: user) } let!(:bookmark2) { Fabricate(:bookmark_next_business_day_reminder, bookmarkable: topic.posts[1], user: user) } @@ -452,13 +452,13 @@ RSpec.describe TopicView do end end - context '.topic_user' do + describe '.topic_user' do it 'returns nil when there is no user' do expect(TopicView.new(topic.id, nil).topic_user).to be_blank end end - context '#recent_posts' do + describe '#recent_posts' do before do 24.times do |t| # our let()s have already created 3 Fabricate(:post, topic: topic, user: first_poster, created_at: t.seconds.from_now) @@ -497,7 +497,7 @@ RSpec.describe TopicView do end end - context '#posts' do + describe '#posts' do # Create the posts in a different order than the sort_order let!(:p5) { Fabricate(:post, topic: topic, user: evil_trout) } diff --git a/spec/lib/twitter_api_spec.rb b/spec/lib/twitter_api_spec.rb index 96f129ed614..a123676dba9 100644 --- a/spec/lib/twitter_api_spec.rb +++ b/spec/lib/twitter_api_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true describe TwitterApi do - context '.link_handles_in' do + describe '.link_handles_in' do it 'correctly replaces handles' do expect(TwitterApi.send(:link_handles_in, "@foo @foobar")).to match_html <<~HTML @foo @foobar @@ -9,7 +9,7 @@ describe TwitterApi do end end - context '.link_hashtags_in' do + describe '.link_hashtags_in' do it 'correctly replaces hashtags' do expect(TwitterApi.send(:link_hashtags_in, "#foo #foobar")).to match_html <<~HTML #foo #foobar diff --git a/spec/lib/validators/post_validator_spec.rb b/spec/lib/validators/post_validator_spec.rb index be547dffa44..d97fcbcc85a 100644 --- a/spec/lib/validators/post_validator_spec.rb +++ b/spec/lib/validators/post_validator_spec.rb @@ -5,7 +5,7 @@ describe PostValidator do let(:post) { build(:post, topic: topic) } let(:validator) { PostValidator.new({}) } - context "#post_body_validator" do + describe "#post_body_validator" do it 'should not allow a post with an empty raw' do post.raw = "" validator.post_body_validator(post) diff --git a/spec/models/badge_spec.rb b/spec/models/badge_spec.rb index c97ce3c6e02..081d0f37197 100644 --- a/spec/models/badge_spec.rb +++ b/spec/models/badge_spec.rb @@ -221,7 +221,7 @@ describe Badge do end end - context "#seed" do + describe "#seed" do let(:regular_badge) do Badge.find(Badge::Regular) diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb index 1eb38821284..4a0f4773067 100644 --- a/spec/models/category_spec.rb +++ b/spec/models/category_spec.rb @@ -1089,13 +1089,13 @@ describe Category do SQL end - context "#depth_of_descendants" do + describe "#depth_of_descendants" do it "should produce max_depth" do expect(category.depth_of_descendants(3)).to eq(3) end end - context "#height_of_ancestors" do + describe "#height_of_ancestors" do it "should produce max_height" do expect(category.height_of_ancestors(3)).to eq(3) end @@ -1107,13 +1107,13 @@ describe Category do category.parent_category_id = category.id end - context "#depth_of_descendants" do + describe "#depth_of_descendants" do it "should produce max_depth" do expect(category.depth_of_descendants(3)).to eq(3) end end - context "#height_of_ancestors" do + describe "#height_of_ancestors" do it "should produce max_height" do expect(category.height_of_ancestors(3)).to eq(3) end @@ -1125,20 +1125,20 @@ describe Category do category.parent_category_id = subcategory.id end - context "#depth_of_descendants" do + describe "#depth_of_descendants" do it "should produce max_depth" do expect(category.depth_of_descendants(3)).to eq(3) end end - context "#height_of_ancestors" do + describe "#height_of_ancestors" do it "should produce max_height" do expect(category.height_of_ancestors(3)).to eq(3) end end end - context "#depth_of_descendants" do + describe "#depth_of_descendants" do it "should be 0 when the category has no descendants" do expect(subcategory.depth_of_descendants).to eq(0) end @@ -1148,7 +1148,7 @@ describe Category do end end - context "#height_of_ancestors" do + describe "#height_of_ancestors" do it "should be 0 when the category has no ancestors" do expect(category.height_of_ancestors).to eq(0) end diff --git a/spec/models/category_user_spec.rb b/spec/models/category_user_spec.rb index 815f094d6c1..2a8b990c71c 100644 --- a/spec/models/category_user_spec.rb +++ b/spec/models/category_user_spec.rb @@ -12,7 +12,7 @@ describe CategoryUser do CategoryUser.notification_levels[:regular] end - context '#batch_set' do + describe '#batch_set' do fab!(:category) { Fabricate(:category) } def category_ids_at_level(level) diff --git a/spec/models/email_token_spec.rb b/spec/models/email_token_spec.rb index 39e64ac0c74..c086b0848fe 100644 --- a/spec/models/email_token_spec.rb +++ b/spec/models/email_token_spec.rb @@ -5,7 +5,7 @@ describe EmailToken do it { is_expected.to validate_presence_of :email } it { is_expected.to belong_to :user } - context '#create' do + describe '#create' do fab!(:user) { Fabricate(:user, active: false) } let!(:original_token) { user.email_tokens.first } let!(:email_token) { Fabricate(:email_token, user: user, email: 'bubblegum@adventuretime.ooo') } @@ -41,7 +41,7 @@ describe EmailToken do end end - context '#confirm' do + describe '#confirm' do fab!(:user) { Fabricate(:user, active: false) } let!(:email_token) { Fabricate(:email_token, user: user) } diff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rb index 2f9dff38047..1deff1e81d2 100644 --- a/spec/models/invite_spec.rb +++ b/spec/models/invite_spec.rb @@ -65,7 +65,7 @@ describe Invite do end end - context '.generate' do + describe '.generate' do it 'saves an invites' do invite = Invite.generate(user, email: 'TEST@EXAMPLE.COM') expect(invite.invite_key).to be_present @@ -201,7 +201,7 @@ describe Invite do end end - context '#redeem' do + describe '#redeem' do fab!(:invite) { Fabricate(:invite) } it 'works' do diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index e3ec7e75636..cf14dc1dd37 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -1491,7 +1491,7 @@ describe Post do expect(UploadReference.count).to eq(0) end - context "#link_post_uploads" do + describe "#link_post_uploads" do it "finds all the uploads in the post" do post.link_post_uploads @@ -1547,7 +1547,7 @@ describe Post do end end - context '#update_uploads_secure_status' do + describe '#update_uploads_secure_status' do fab!(:user) { Fabricate(:user, trust_level: 0) } let(:raw) do diff --git a/spec/models/remote_theme_spec.rb b/spec/models/remote_theme_spec.rb index 1080f181f3f..5ceacba0107 100644 --- a/spec/models/remote_theme_spec.rb +++ b/spec/models/remote_theme_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true describe RemoteTheme do - context '#import_remote' do + describe '#import_remote' do def about_json(love_color: "FAFAFA", tertiary_low_color: "FFFFFF", color_scheme_name: "Amazing", about_url: "https://www.site.com/about") <<~JSON { @@ -201,7 +201,7 @@ describe RemoteTheme do ) end - context "#github_diff_link" do + describe "#github_diff_link" do it "is blank for non-github repos" do expect(gitlab_repo.github_diff_link).to be_blank end @@ -218,7 +218,7 @@ describe RemoteTheme do end end - context ".joined_remotes" do + describe ".joined_remotes" do it "finds records that are associated with themes" do github_repo gitlab_repo @@ -232,7 +232,7 @@ describe RemoteTheme do end end - context ".out_of_date_themes" do + describe ".out_of_date_themes" do let(:remote) { RemoteTheme.create!(remote_url: "https://github.com/org/testtheme") } let!(:theme) { Fabricate(:theme, remote_theme: remote) } @@ -252,7 +252,7 @@ describe RemoteTheme do end - context ".unreachable_themes" do + describe ".unreachable_themes" do let(:remote) { RemoteTheme.create!(remote_url: "https://github.com/org/testtheme", last_error_text: "can't contact this repo :(") } let!(:theme) { Fabricate(:theme, remote_theme: remote) } diff --git a/spec/models/reviewable_spec.rb b/spec/models/reviewable_spec.rb index 36099af81f9..92fdbbdf9c3 100644 --- a/spec/models/reviewable_spec.rb +++ b/spec/models/reviewable_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Reviewable, type: :model do - context ".create" do + describe ".create" do fab!(:admin) { Fabricate(:admin) } fab!(:user) { Fabricate(:user) } @@ -31,7 +31,7 @@ RSpec.describe Reviewable, type: :model do end end - context ".needs_review!" do + describe ".needs_review!" do fab!(:admin) { Fabricate(:admin) } fab!(:user) { Fabricate(:user) } @@ -86,7 +86,7 @@ RSpec.describe Reviewable, type: :model do end end - context ".list_for" do + describe ".list_for" do fab!(:user) { Fabricate(:user) } it "returns an empty list for nil user" do @@ -381,7 +381,7 @@ RSpec.describe Reviewable, type: :model do end end - context ".score_required_to_hide_post" do + describe ".score_required_to_hide_post" do it "will return the default visibility if it's higher" do Reviewable.set_priorities(low: 40.0, high: 100.0) @@ -411,7 +411,7 @@ RSpec.describe Reviewable, type: :model do end end - context ".spam_score_to_silence_new_user" do + describe ".spam_score_to_silence_new_user" do it "returns a default value if we can't calculated any percentiles" do SiteSetting.silence_new_user_sensitivity = Reviewable.sensitivity[:low] expect(Reviewable.spam_score_to_silence_new_user).to eq(7.5) @@ -434,7 +434,7 @@ RSpec.describe Reviewable, type: :model do end end - context ".score_to_auto_close_topic" do + describe ".score_to_auto_close_topic" do it "returns the default if we can't calculated any percentiles" do SiteSetting.auto_close_topic_sensitivity = Reviewable.sensitivity[:low] diff --git a/spec/models/reviewable_user_spec.rb b/spec/models/reviewable_user_spec.rb index 8debc148bad..ffd345db217 100644 --- a/spec/models/reviewable_user_spec.rb +++ b/spec/models/reviewable_user_spec.rb @@ -55,7 +55,7 @@ RSpec.describe ReviewableUser, type: :model do end end - context "#update_fields" do + describe "#update_fields" do fab!(:moderator) { Fabricate(:moderator) } fab!(:reviewable) { Fabricate(:reviewable) } diff --git a/spec/models/topic_embed_spec.rb b/spec/models/topic_embed_spec.rb index 8590d31ac68..bf7d82aacdc 100644 --- a/spec/models/topic_embed_spec.rb +++ b/spec/models/topic_embed_spec.rb @@ -8,7 +8,7 @@ describe TopicEmbed do it { is_expected.to belong_to :post } it { is_expected.to validate_presence_of :embed_url } - context '.import' do + describe '.import' do fab!(:user) { Fabricate(:user) } let(:title) { "How to turn a fish from good to evil in 30 seconds" } @@ -173,7 +173,7 @@ describe TopicEmbed do end end - context '.topic_id_for_embed' do + describe '.topic_id_for_embed' do it "returns correct topic id irrespective of url protocol" do topic_embed = Fabricate(:topic_embed, embed_url: "http://example.com/post/248") @@ -195,7 +195,7 @@ describe TopicEmbed do describe '.find_remote' do fab!(:embeddable_host) { Fabricate(:embeddable_host) } - context ".title_scrub" do + describe ".title_scrub" do let(:url) { 'http://eviltrout.com/123' } let(:contents) { "