DEV: Remove extraneous spec code (#29386)

namely `js: true`, requiring `rails_helper`, and default `freeze_time` args
This commit is contained in:
Jarek Radosz 2024-10-24 14:15:32 +02:00 committed by GitHub
parent f84f7436c5
commit 587264f9d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 15 additions and 19 deletions

View File

@ -2,7 +2,7 @@
# NOTE: This spec covers core functionality, but it is much easier # NOTE: This spec covers core functionality, but it is much easier
# to test plugin related things inside an actual plugin. # 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) } fab!(:current_user) { Fabricate(:admin) }
let(:admin_plugins_list_page) { PageObjects::Pages::AdminPluginsList.new } let(:admin_plugins_list_page) { PageObjects::Pages::AdminPluginsList.new }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
describe "DiscourseAutomation | error", type: :system, js: true do describe "DiscourseAutomation | error", type: :system do
fab!(:admin) fab!(:admin)
before do before do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
describe "DiscourseAutomation | New automation", type: :system, js: true do describe "DiscourseAutomation | New automation", type: :system do
fab!(:admin) fab!(:admin)
before do before do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
describe "DiscourseAutomation | smoke test", type: :system, js: true do describe "DiscourseAutomation | smoke test", type: :system do
fab!(:admin) fab!(:admin)
fab!(:group) { Fabricate(:group, name: "test") } fab!(:group) { Fabricate(:group, name: "test") }
fab!(:badge) { Fabricate(:badge, name: "badge") } fab!(:badge) { Fabricate(:badge, name: "badge") }

View File

@ -287,7 +287,7 @@ RSpec.shared_examples "remote backup store" do
def upload_file def upload_file
# time has fidelity issues freeze a time that is not going to be prone # time has fidelity issues freeze a time that is not going to be prone
# to that # 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) backup = BackupFile.new(filename: "foo.tar.gz", size: 33, last_modified: Time.zone.now)

View File

@ -432,7 +432,7 @@ RSpec.describe PostAction do
end end
it "shouldn't change given_likes unless likes are given or removed" do it "shouldn't change given_likes unless likes are given or removed" do
freeze_time(Time.zone.now) freeze_time
PostActionCreator.like(codinghorror, post) PostActionCreator.like(codinghorror, post)
expect(value_for(codinghorror.id, Date.today)).to eq(1) expect(value_for(codinghorror.id, Date.today)).to eq(1)

View File

@ -236,7 +236,7 @@ RSpec.describe TopicUser do
it "should update the record for repeat visit" do it "should update the record for repeat visit" do
today = Time.zone.now today = Time.zone.now
freeze_time Time.zone.now freeze_time today
# ensure data model is correct for the test # ensure data model is correct for the test
# logging an update to a row that does not exist # logging an update to a row that does not exist

View File

@ -24,7 +24,7 @@ RSpec.describe UserAvatar do
after { temp.unlink } after { temp.unlink }
it "can update gravatars" do it "can update gravatars" do
freeze_time Time.now freeze_time
expect { avatar.update_gravatar! }.to change { Upload.count }.by(1) expect { avatar.update_gravatar! }.to change { Upload.count }.by(1)
expect(avatar.gravatar_upload).to eq(Upload.last) expect(avatar.gravatar_upload).to eq(Upload.last)
@ -76,7 +76,7 @@ RSpec.describe UserAvatar do
describe "when failing" do describe "when failing" do
it "always update 'last_gravatar_download_attempt'" do it "always update 'last_gravatar_download_attempt'" do
freeze_time Time.now freeze_time
FileHelper.expects(:download).raises(SocketError) FileHelper.expects(:download).raises(SocketError)
@ -91,7 +91,7 @@ RSpec.describe UserAvatar do
describe "404 should be silent, nothing to do really" do describe "404 should be silent, nothing to do really" do
it "does nothing when avatar is 404" do it "does nothing when avatar is 404" do
SecureRandom.stubs(:urlsafe_base64).returns("5555") SecureRandom.stubs(:urlsafe_base64).returns("5555")
freeze_time Time.now freeze_time
stub_request( stub_request(
:get, :get,

View File

@ -3904,7 +3904,7 @@ RSpec.describe UsersController do
context "when expiring_at param is set" do context "when expiring_at param is set" do
it "changes notification level to ignore" do it "changes notification level to ignore" do
freeze_time(Time.now) do freeze_time do
expiring_at = 3.days.from_now expiring_at = 3.days.from_now
put "/u/#{another_user.username}/notification_level.json", put "/u/#{another_user.username}/notification_level.json",
params: { params: {

View File

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require "rails_helper"
RSpec.describe User::Silence do RSpec.describe User::Silence do
describe described_class::Contract, type: :model do describe described_class::Contract, type: :model do
it { is_expected.to validate_presence_of(:user_id) } it { is_expected.to validate_presence_of(:user_id) }

View File

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require "rails_helper"
RSpec.describe User::Suspend do RSpec.describe User::Suspend do
describe described_class::Contract, type: :model do describe described_class::Contract, type: :model do
it { is_expected.to validate_presence_of(:user_id) } it { is_expected.to validate_presence_of(:user_id) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # 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) } fab!(:current_user) { Fabricate(:admin) }
before { sign_in(current_user) } before { sign_in(current_user) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # 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) } fab!(:current_user) { Fabricate(:admin) }
before { sign_in(current_user) } before { sign_in(current_user) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # 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) } fab!(:current_user) { Fabricate(:user) }
let!(:sidebar_navigation) { PageObjects::Components::NavigationMenu::Sidebar.new } let!(:sidebar_navigation) { PageObjects::Components::NavigationMenu::Sidebar.new }
let!(:header_dropdown) { PageObjects::Components::NavigationMenu::HeaderDropdown.new } let!(:header_dropdown) { PageObjects::Components::NavigationMenu::HeaderDropdown.new }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
describe "Post menu", type: :system, js: true do describe "Post menu", type: :system do
fab!(:current_user) { Fabricate(:user) } fab!(:current_user) { Fabricate(:user) }
fab!(:topic) fab!(:topic)
fab!(:post) { Fabricate(:post, topic: topic) } fab!(:post) { Fabricate(:post, topic: topic) }