Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove extraneous spec code (#29386)

Jarek Radosz587264f9d2bd
diff --git a/plugins/automation/spec/system/admin_plugins_list_spec.rb b/plugins/automation/spec/system/admin_plugins_list_spec.rb
index b84397e965f..9dc0e1beee6 100644
--- a/plugins/automation/spec/system/admin_plugins_list_spec.rb
+++ b/plugins/automation/spec/system/admin_plugins_list_spec.rb
@@ -2,7 +2,7 @@
# NOTE: This spec covers core functionality, but it is much easier
# to test plugin related things inside an actual plugin.
-describe "Admin Plugins List", type: :system, js: true do
+describe "Admin Plugins List", type: :system do
fab!(:current_user) { Fabricate(:admin) }
let(:admin_plugins_list_page) { PageObjects::Pages::AdminPluginsList.new }
diff --git a/plugins/automation/spec/system/error_spec.rb b/plugins/automation/spec/system/error_spec.rb
index 515be7339eb..8b4532b919c 100644
--- a/plugins/automation/spec/system/error_spec.rb
+++ b/plugins/automation/spec/system/error_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe "DiscourseAutomation | error", type: :system, js: true do
+describe "DiscourseAutomation | error", type: :system do
fab!(:admin)
before do
diff --git a/plugins/automation/spec/system/new_automation_spec.rb b/plugins/automation/spec/system/new_automation_spec.rb
index a4602aa2659..4139524d29f 100644
--- a/plugins/automation/spec/system/new_automation_spec.rb
+++ b/plugins/automation/spec/system/new_automation_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe "DiscourseAutomation | New automation", type: :system, js: true do
+describe "DiscourseAutomation | New automation", type: :system do
fab!(:admin)
before do
diff --git a/plugins/automation/spec/system/smoke_test_spec.rb b/plugins/automation/spec/system/smoke_test_spec.rb
index 4847510d66a..b47a2b23b25 100644
--- a/plugins/automation/spec/system/smoke_test_spec.rb
+++ b/plugins/automation/spec/system/smoke_test_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe "DiscourseAutomation | smoke test", type: :system, js: true do
+describe "DiscourseAutomation | smoke test", type: :system do
fab!(:admin)
fab!(:group) { Fabricate(:group, name: "test") }
fab!(:badge) { Fabricate(:badge, name: "badge") }
diff --git a/spec/lib/backup_restore/shared_examples_for_backup_store.rb b/spec/lib/backup_restore/shared_examples_for_backup_store.rb
index f9338d9e340..3c43e8e8c1f 100644
--- a/spec/lib/backup_restore/shared_examples_for_backup_store.rb
+++ b/spec/lib/backup_restore/shared_examples_for_backup_store.rb
@@ -287,7 +287,7 @@ RSpec.shared_examples "remote backup store" do
def upload_file
# time has fidelity issues freeze a time that is not going to be prone
# to that
- freeze_time(Time.now.to_s)
+ freeze_time(Time.now.round)
backup = BackupFile.new(filename: "foo.tar.gz", size: 33, last_modified: Time.zone.now)
diff --git a/spec/models/post_action_spec.rb b/spec/models/post_action_spec.rb
index 5fe17cf5310..bd554e4e942 100644
--- a/spec/models/post_action_spec.rb
+++ b/spec/models/post_action_spec.rb
@@ -432,7 +432,7 @@ RSpec.describe PostAction do
end
it "shouldn't change given_likes unless likes are given or removed" do
- freeze_time(Time.zone.now)
+ freeze_time
PostActionCreator.like(codinghorror, post)
expect(value_for(codinghorror.id, Date.today)).to eq(1)
diff --git a/spec/models/topic_user_spec.rb b/spec/models/topic_user_spec.rb
index 640ef48d52f..93ba9870862 100644
--- a/spec/models/topic_user_spec.rb
+++ b/spec/models/topic_user_spec.rb
@@ -236,7 +236,7 @@ RSpec.describe TopicUser do
it "should update the record for repeat visit" do
today = Time.zone.now
- freeze_time Time.zone.now
+ freeze_time today
# ensure data model is correct for the test
# logging an update to a row that does not exist
diff --git a/spec/models/user_avatar_spec.rb b/spec/models/user_avatar_spec.rb
index 564009c8f93..56d4e7ae287 100644
--- a/spec/models/user_avatar_spec.rb
+++ b/spec/models/user_avatar_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe UserAvatar do
after { temp.unlink }
it "can update gravatars" do
- freeze_time Time.now
+ freeze_time
expect { avatar.update_gravatar! }.to change { Upload.count }.by(1)
expect(avatar.gravatar_upload).to eq(Upload.last)
@@ -76,7 +76,7 @@ RSpec.describe UserAvatar do
describe "when failing" do
it "always update 'last_gravatar_download_attempt'" do
- freeze_time Time.now
+ freeze_time
FileHelper.expects(:download).raises(SocketError)
@@ -91,7 +91,7 @@ RSpec.describe UserAvatar do
describe "404 should be silent, nothing to do really" do
it "does nothing when avatar is 404" do
SecureRandom.stubs(:urlsafe_base64).returns("5555")
- freeze_time Time.now
+ freeze_time
stub_request(
:get,
diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb
index cb0a20ea72c..d1153df207f 100644
--- a/spec/requests/users_controller_spec.rb
+++ b/spec/requests/users_controller_spec.rb
@@ -3904,7 +3904,7 @@ RSpec.describe UsersController do
context "when expiring_at param is set" do
it "changes notification level to ignore" do
- freeze_time(Time.now) do
+ freeze_time do
expiring_at = 3.days.from_now
put "/u/#{another_user.username}/notification_level.json",
params: {
diff --git a/spec/services/user/silence_spec.rb b/spec/services/user/silence_spec.rb
index 10047ba9fba..102255650d0 100644
--- a/spec/services/user/silence_spec.rb
+++ b/spec/services/user/silence_spec.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "rails_helper"
-
RSpec.describe User::Silence do
describe described_class::Contract, type: :model do
it { is_expected.to validate_presence_of(:user_id) }
diff --git a/spec/services/user/suspend_spec.rb b/spec/services/user/suspend_spec.rb
index aacd924c4e2..8b823f7bf41 100644
--- a/spec/services/user/suspend_spec.rb
+++ b/spec/services/user/suspend_spec.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "rails_helper"
-
RSpec.describe User::Suspend do
describe described_class::Contract, type: :model do
it { is_expected.to validate_presence_of(:user_id) }
diff --git a/spec/system/admin_user_fields_spec.rb b/spec/system/admin_user_fields_spec.rb
index b8b14fb869c..ad0a423caf4 100644
--- a/spec/system/admin_user_fields_spec.rb
+++ b/spec/system/admin_user_fields_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe "Admin User Fields", type: :system, js: true do
+describe "Admin User Fields", type: :system do
fab!(:current_user) { Fabricate(:admin) }
before { sign_in(current_user) }
diff --git a/spec/system/admin_watched_words_spec.rb b/spec/system/admin_watched_words_spec.rb
index 1eb14e1f04c..ab330677b98 100644
--- a/spec/system/admin_watched_words_spec.rb
+++ b/spec/system/admin_watched_words_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe "Admin Watched Words", type: :system, js: true do
+describe "Admin Watched Words", type: :system do
fab!(:current_user) { Fabricate(:admin) }
before { sign_in(current_user) }
diff --git a/spec/system/navigation_menu_state_integration_spec.rb b/spec/system/navigation_menu_state_integration_spec.rb
index 63c741d7233..47aa3a175dc 100644
--- a/spec/system/navigation_menu_state_integration_spec.rb
+++ b/spec/system/navigation_menu_state_integration_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe "Navigation menu states", type: :system, js: true do
+describe "Navigation menu states", type: :system do
fab!(:current_user) { Fabricate(:user) }
let!(:sidebar_navigation) { PageObjects::Components::NavigationMenu::Sidebar.new }
let!(:header_dropdown) { PageObjects::Components::NavigationMenu::HeaderDropdown.new }
diff --git a/spec/system/post_menu_spec.rb b/spec/system/post_menu_spec.rb
index 490b489082d..b6ac1a15ced 100644
--- a/spec/system/post_menu_spec.rb
+++ b/spec/system/post_menu_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-describe "Post menu", type: :system, js: true do
+describe "Post menu", type: :system do
fab!(:current_user) { Fabricate(:user) }
fab!(:topic)
fab!(:post) { Fabricate(:post, topic: topic) }