mirror of
https://github.com/discourse/discourse.git
synced 2024-11-21 20:40:58 +08:00
Add RSpec 4 compatibility (#17652)
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
This commit is contained in:
parent
72b24f3fb9
commit
493d437e79
|
@ -3,7 +3,7 @@
|
|||
require 'rails_helper'
|
||||
require 'pretty_text'
|
||||
|
||||
describe PrettyText do
|
||||
RSpec.describe PrettyText do
|
||||
|
||||
let(:post) { Fabricate(:post) }
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ def generate_html(text, opts = {})
|
|||
output + "</span></p>"
|
||||
end
|
||||
|
||||
describe PrettyText do
|
||||
RSpec.describe PrettyText do
|
||||
before do
|
||||
freeze_time
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Post do
|
||||
RSpec.describe Post do
|
||||
|
||||
before do
|
||||
Jobs.run_immediately!
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe DiscourseNarrativeBot::NewUserNarrative do
|
||||
RSpec.describe DiscourseNarrativeBot::NewUserNarrative do
|
||||
fab!(:welcome_topic) { Fabricate(:topic, title: 'Welcome to Discourse') }
|
||||
fab!(:narrative_bot) { ::DiscourseNarrativeBot::Base.new }
|
||||
fab!(:discobot_user) { narrative_bot.discobot_user }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe DiscourseNarrativeBot::Store do
|
||||
RSpec.describe DiscourseNarrativeBot::Store do
|
||||
describe '.set' do
|
||||
it 'should set the right value in the plugin store' do
|
||||
key = 'somekey'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe DiscourseNarrativeBot::TrackSelector do
|
||||
RSpec.describe DiscourseNarrativeBot::TrackSelector do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:narrative_bot) { ::DiscourseNarrativeBot::Base.new }
|
||||
let(:discobot_user) { narrative_bot.discobot_user }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::DiscourseNarrativeBot::RemapOldBotImages do
|
||||
RSpec.describe Jobs::DiscourseNarrativeBot::RemapOldBotImages do
|
||||
context "when bot's post contains an old link" do
|
||||
let!(:post) do
|
||||
Fabricate(:post,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "Discobot Certificate" do
|
||||
RSpec.describe "Discobot Certificate" do
|
||||
let(:user) { Fabricate(:user, name: 'Jeff Atwood') }
|
||||
|
||||
let(:params) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "Discobot welcome post" do
|
||||
RSpec.describe "Discobot welcome post" do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe User do
|
||||
RSpec.describe User do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:profile_page_url) { "#{Discourse.base_url}/users/#{user.username}" }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "discourse-presence" do
|
||||
RSpec.describe "discourse-presence" do
|
||||
describe 'PresenceChannel configuration' do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:user2) { Fabricate(:user) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
describe ::DiscoursePoll::PollsController do
|
||||
RSpec.describe ::DiscoursePoll::PollsController do
|
||||
routes { ::DiscoursePoll::Engine.routes }
|
||||
|
||||
let!(:user) { log_in }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
describe PostsController do
|
||||
RSpec.describe PostsController do
|
||||
let!(:user) { log_in }
|
||||
let!(:title) { "Testing Poll Plugin" }
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
describe "DiscoursePoll endpoints" do
|
||||
RSpec.describe "DiscoursePoll endpoints" do
|
||||
describe "fetch voters for a poll" do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:post) { Fabricate(:post, raw: "[poll public=true]\n- A\n- B\n[/poll]") }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
describe Jobs::ClosePoll do
|
||||
RSpec.describe Jobs::ClosePoll do
|
||||
let(:post) { Fabricate(:post, raw: "[poll]\n- A\n- B\n[/poll]") }
|
||||
|
||||
describe 'missing arguments' do
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
describe NewPostManager do
|
||||
RSpec.describe NewPostManager do
|
||||
let(:user) { Fabricate(:newuser) }
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe DiscoursePoll::Poll do
|
||||
RSpec.describe DiscoursePoll::Poll do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:user_2) { Fabricate(:user) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe DiscoursePoll::PollsUpdater do
|
||||
RSpec.describe DiscoursePoll::PollsUpdater do
|
||||
|
||||
def update(post, polls)
|
||||
DiscoursePoll::PollsUpdater.update(post, polls)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
describe ::DiscoursePoll::PollsValidator do
|
||||
RSpec.describe ::DiscoursePoll::PollsValidator do
|
||||
let(:post) { Fabricate(:post) }
|
||||
subject { described_class.new(post) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe PrettyText do
|
||||
RSpec.describe PrettyText do
|
||||
|
||||
def n(html)
|
||||
html.strip
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe ::DiscoursePoll::Poll do
|
||||
RSpec.describe ::DiscoursePoll::Poll do
|
||||
describe ".transform_for_user_field_override" do
|
||||
it "Transforms UserField name if a matching CustomUserField is present" do
|
||||
user_field_name = "Something Cool"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
describe Admin::UsersController do
|
||||
RSpec.describe Admin::UsersController do
|
||||
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ def serialize_option(option, user)
|
|||
)
|
||||
end
|
||||
|
||||
describe PollOptionSerializer do
|
||||
RSpec.describe PollOptionSerializer do
|
||||
let(:voter) { Fabricate(:user) }
|
||||
let(:poll) { post.polls.first }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'SiteSetting.styleguide_admin_only' do
|
||||
RSpec.describe 'SiteSetting.styleguide_admin_only' do
|
||||
before do
|
||||
SiteSetting.styleguide_enabled = true
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ describe 'SiteSetting.styleguide_admin_only' do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'SiteSetting.styleguide_enabled' do
|
||||
RSpec.describe 'SiteSetting.styleguide_enabled' do
|
||||
before do
|
||||
sign_in(Fabricate(:admin))
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'Styleguide assets' do
|
||||
RSpec.describe 'Styleguide assets' do
|
||||
before do
|
||||
SiteSetting.styleguide_enabled = true
|
||||
sign_in(Fabricate(:admin))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# coding: utf-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe ApplicationHelper do
|
||||
RSpec.describe ApplicationHelper do
|
||||
|
||||
describe "preload_script" do
|
||||
def preload_link(url)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe TopicsHelper do
|
||||
RSpec.describe TopicsHelper do
|
||||
|
||||
describe "#categories_breadcrumb" do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe UserNotificationsHelper do
|
||||
RSpec.describe UserNotificationsHelper do
|
||||
let(:upload_path) { Discourse.store.upload_path }
|
||||
|
||||
describe '#email_excerpt' do
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "import_export"
|
||||
|
||||
describe ImportExport::CategoryExporter do
|
||||
RSpec.describe ImportExport::CategoryExporter do
|
||||
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
fab!(:group) { Fabricate(:group) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "import_export/category_structure_exporter"
|
||||
|
||||
describe ImportExport::CategoryStructureExporter do
|
||||
RSpec.describe ImportExport::CategoryStructureExporter do
|
||||
|
||||
before do
|
||||
STDOUT.stubs(:write)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "import_export/group_exporter"
|
||||
|
||||
describe ImportExport::GroupExporter do
|
||||
RSpec.describe ImportExport::GroupExporter do
|
||||
|
||||
before do
|
||||
STDOUT.stubs(:write)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "import_export"
|
||||
|
||||
describe ImportExport::Importer do
|
||||
RSpec.describe ImportExport::Importer do
|
||||
|
||||
before do
|
||||
STDOUT.stubs(:write)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "import_export"
|
||||
|
||||
describe ImportExport::TopicExporter do
|
||||
RSpec.describe ImportExport::TopicExporter do
|
||||
|
||||
before do
|
||||
STDOUT.stubs(:write)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'Setting changes' do
|
||||
RSpec.describe 'Setting changes' do
|
||||
describe '#must_approve_users' do
|
||||
before { SiteSetting.must_approve_users = false }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'api keys' do
|
||||
RSpec.describe 'api keys' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:api_key) { ApiKey.create!(user_id: user.id, created_by_id: Discourse.system_user) }
|
||||
|
||||
|
@ -61,7 +61,7 @@ describe 'api keys' do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'user api keys' do
|
||||
RSpec.describe 'user api keys' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:user_api_key) { Fabricate(:readonly_user_api_key, user: user) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "auto reject reviewable users" do
|
||||
RSpec.describe "auto reject reviewable users" do
|
||||
context "reviewable users" do
|
||||
fab!(:old_user) { Fabricate(:reviewable, created_at: 80.days.ago) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "hotlinked media blocking" do
|
||||
RSpec.describe "hotlinked media blocking" do
|
||||
let(:hotlinked_url) { "http://example.com/images/2/2e/Longcat1.png" }
|
||||
let(:onebox_url) { "http://example.com/onebox" }
|
||||
let(:png) { Base64.decode64("R0lGODlhAQABALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD//wBiZCH5BAEAAA8ALAAAAAABAAEAAAQC8EUAOw==") }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "category tag restrictions" do
|
||||
RSpec.describe "category tag restrictions" do
|
||||
|
||||
def filter_allowed_tags(opts = {})
|
||||
DiscourseTagging.filter_allowed_tags(Guardian.new(user), opts)
|
||||
|
@ -427,7 +427,7 @@ describe "category tag restrictions" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "tag topic counts per category" do
|
||||
RSpec.describe "tag topic counts per category" do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
fab!(:category2) { Fabricate(:category) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'content security policy integration' do
|
||||
RSpec.describe 'content security policy integration' do
|
||||
|
||||
it "adds the csp headers correctly" do
|
||||
SiteSetting.content_security_policy = false
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# with mailer specific mailer specs like UserEmail, but sometimes we need
|
||||
# to test things along the whole outbound flow including the MessageBuilder
|
||||
# and the Sender.
|
||||
describe "Outbound Email" do
|
||||
RSpec.describe "Outbound Email" do
|
||||
def send_email(opts = {})
|
||||
message = TestMailer.send_test("test@test.com", opts)
|
||||
result = Email::Sender.new(message, :test_message).send
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe EmailStyle do
|
||||
RSpec.describe EmailStyle do
|
||||
|
||||
context "ERB evaluation" do
|
||||
it "does not evaluate ERB outside of the email itself" do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe PostAction do
|
||||
RSpec.describe PostAction do
|
||||
|
||||
it "triggers the 'flag_reviewed' event when there was at least one flag" do
|
||||
admin = Fabricate(:admin)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Group do
|
||||
RSpec.describe Group do
|
||||
let(:group) do
|
||||
Fabricate(
|
||||
:group,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'invalid requests', type: :request do
|
||||
RSpec.describe 'invalid requests', type: :request do
|
||||
before do
|
||||
@orig_logger = Rails.logger
|
||||
Rails.logger = @fake_logger = FakeLogger.new
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe 'invite only' do
|
||||
RSpec.describe 'invite only' do
|
||||
|
||||
describe '#create invite only' do
|
||||
it 'can create user via API' do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'message bus integration' do
|
||||
RSpec.describe 'message bus integration' do
|
||||
|
||||
it "allows anonymous requests to the messagebus" do
|
||||
post "/message-bus/poll"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'multisite', type: [:multisite, :request] do
|
||||
RSpec.describe 'multisite', type: [:multisite, :request] do
|
||||
it "works" do
|
||||
get "http://test.localhost/session/csrf.json"
|
||||
expect(response.status).to eq(200)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'multisite', type: [:multisite, :request] do
|
||||
RSpec.describe 'multisite', type: [:multisite, :request] do
|
||||
it "should always allow /srv/status through" do
|
||||
get "http://unknown.com/srv/status"
|
||||
expect(response.status).to eq(200)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe 'rate limiter integration' do
|
||||
RSpec.describe 'rate limiter integration' do
|
||||
|
||||
before do
|
||||
RateLimiter.enable
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "spammers on same IP" do
|
||||
RSpec.describe "spammers on same IP" do
|
||||
|
||||
let(:ip_address) { '182.189.119.174' }
|
||||
let!(:spammer1) { Fabricate(:user, ip_address: ip_address) }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "spam rules for users" do
|
||||
RSpec.describe "spam rules for users" do
|
||||
|
||||
describe 'auto-silence users based on flagging' do
|
||||
fab!(:admin) { Fabricate(:admin) } # needed to send a system message
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Topic do
|
||||
RSpec.describe Topic do
|
||||
let(:job_klass) { Jobs::CloseTopic }
|
||||
|
||||
context 'creating a topic without auto-close' do
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
describe "Topic Thumbnails" do
|
||||
RSpec.describe "Topic Thumbnails" do
|
||||
before do
|
||||
SiteSetting.create_thumbnails = true
|
||||
ImageSizer.stubs(:resize).returns([9, 9])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe WatchedWord do
|
||||
RSpec.describe WatchedWord do
|
||||
fab!(:tl2_user) { Fabricate(:user, trust_level: TrustLevel[2]) }
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:moderator) { Fabricate(:moderator) }
|
||||
|
|
|
@ -17,7 +17,7 @@ def grep_file(file, regex)
|
|||
lines.count > 0 ? file : nil
|
||||
end
|
||||
|
||||
describe 'Coding style' do
|
||||
RSpec.describe 'Coding style' do
|
||||
describe 'Javascript' do
|
||||
it 'prevents this.get("foo") pattern' do
|
||||
js_files = list_js_files('app/assets/javascripts')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
describe "CommonMark" do
|
||||
RSpec.describe "CommonMark" do
|
||||
it 'passes spec' do
|
||||
|
||||
SiteSetting.traditional_markdown_linebreaks = true
|
||||
|
|
|
@ -20,7 +20,7 @@ def is_yaml_compatible?(english, translated)
|
|||
true
|
||||
end
|
||||
|
||||
describe "i18n integrity checks" do
|
||||
RSpec.describe "i18n integrity checks" do
|
||||
it "has an i18n key for each Site Setting" do
|
||||
SiteSetting.all_settings.each do |s|
|
||||
next if s[:setting][/^test_/]
|
||||
|
@ -97,7 +97,7 @@ describe "i18n integrity checks" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "fallbacks" do
|
||||
RSpec.describe "fallbacks" do
|
||||
before do
|
||||
I18n.backend = I18n::Backend::DiscourseI18n.new
|
||||
I18n.fallbacks = I18n::Backend::FallbackLocaleList.new
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "constants match ruby" do
|
||||
RSpec.describe "constants match ruby" do
|
||||
|
||||
let(:ctx) { MiniRacer::Context.new }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'Oj' do
|
||||
RSpec.describe 'Oj' do
|
||||
it "is enabled" do
|
||||
classes = Set.new
|
||||
tracer = TracePoint.new(:c_call) { |tp| classes << tp.defined_class }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe ::Jobs::Onceoff do
|
||||
RSpec.describe ::Jobs::Onceoff do
|
||||
it "can run all once off jobs without errors" do
|
||||
# Load all once offs
|
||||
Dir[Rails.root + 'app/jobs/onceoff/*.rb'].each do |f|
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "site setting integrity checks" do
|
||||
RSpec.describe "site setting integrity checks" do
|
||||
let(:site_setting_file) { File.join(Rails.root, 'config', 'site_settings.yml') }
|
||||
let(:yaml) { YAML.load_file(site_setting_file) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::AboutStats do
|
||||
RSpec.describe Jobs::AboutStats do
|
||||
it 'caches the stats' do
|
||||
begin
|
||||
stats = About.fetch_stats.to_json
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::ActivationReminderEmails do
|
||||
RSpec.describe Jobs::ActivationReminderEmails do
|
||||
before { Jobs.run_immediately! }
|
||||
|
||||
# should be between 2 and 3 days
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::AutoQueueHandler do
|
||||
RSpec.describe Jobs::AutoQueueHandler do
|
||||
|
||||
subject { Jobs::AutoQueueHandler.new.execute({}) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::AutomaticGroupMembership do
|
||||
RSpec.describe Jobs::AutomaticGroupMembership do
|
||||
|
||||
it "raises an error when the group id is missing" do
|
||||
expect { Jobs::AutomaticGroupMembership.new.execute({}) }.to raise_error(Discourse::InvalidParameters)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::BulkGrantTrustLevel do
|
||||
RSpec.describe Jobs::BulkGrantTrustLevel do
|
||||
|
||||
it "raises an error when trust_level is missing" do
|
||||
expect { Jobs::BulkGrantTrustLevel.new.execute(user_ids: [1, 2]) }.to raise_error(Discourse::InvalidParameters)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::BulkInvite do
|
||||
RSpec.describe Jobs::BulkInvite do
|
||||
describe '#execute' do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::BumpTopic do
|
||||
RSpec.describe Jobs::BumpTopic do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CleanDismissedTopicUsers do
|
||||
RSpec.describe Jobs::CleanDismissedTopicUsers do
|
||||
fab!(:user) { Fabricate(:user, created_at: 1.days.ago, previous_visit_at: 1.days.ago) }
|
||||
fab!(:topic) { Fabricate(:topic, created_at: 5.hours.ago) }
|
||||
fab!(:dismissed_topic_user) { Fabricate(:dismissed_topic_user, user: user, topic: topic) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CleanUpAssociatedAccounts do
|
||||
RSpec.describe Jobs::CleanUpAssociatedAccounts do
|
||||
subject { Jobs::CleanUpAssociatedAccounts.new.execute({}) }
|
||||
|
||||
it "deletes the correct records" do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CleanUpCrawlerStats do
|
||||
RSpec.describe Jobs::CleanUpCrawlerStats do
|
||||
subject { Jobs::CleanUpCrawlerStats.new.execute({}) }
|
||||
|
||||
it "deletes records older than 30 days old" do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CleanUpEmailChangeRequests do
|
||||
RSpec.describe Jobs::CleanUpEmailChangeRequests do
|
||||
it "deletes records older than 1 month" do
|
||||
very_old = Fabricate(:email_change_request, updated_at: 32.days.ago)
|
||||
yesterday = Fabricate(:email_change_request, updated_at: 1.day.ago)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CleanUpEmailLogs do
|
||||
RSpec.describe Jobs::CleanUpEmailLogs do
|
||||
fab!(:email_log) { Fabricate(:email_log, created_at: 2.years.ago) }
|
||||
fab!(:email_log2) { Fabricate(:email_log, created_at: 2.weeks.ago) }
|
||||
fab!(:email_log3) { Fabricate(:email_log, created_at: 2.days.ago) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CleanUpUploads do
|
||||
RSpec.describe Jobs::CleanUpUploads do
|
||||
|
||||
def fabricate_upload(attributes = {})
|
||||
Fabricate(:upload, { created_at: 2.hours.ago }.merge(attributes))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CleanupImapSyncLog do
|
||||
RSpec.describe Jobs::CleanupImapSyncLog do
|
||||
let(:job_class) { Jobs::CleanupImapSyncLog.new }
|
||||
|
||||
it "deletes logs older than RETAIN_LOGS_DAYS" do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CloseTopic do
|
||||
RSpec.describe Jobs::CloseTopic do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
|
||||
fab!(:topic) do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CorrectMissingDualstackUrls do
|
||||
RSpec.describe Jobs::CorrectMissingDualstackUrls do
|
||||
it 'corrects the urls' do
|
||||
setup_s3
|
||||
SiteSetting.s3_region = "us-east-1"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CrawlTopicLink do
|
||||
RSpec.describe Jobs::CrawlTopicLink do
|
||||
|
||||
let(:job) { Jobs::CrawlTopicLink.new }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CreateLinkedTopic do
|
||||
RSpec.describe Jobs::CreateLinkedTopic do
|
||||
it "returns when the post cannot be found" do
|
||||
expect { Jobs::CreateLinkedTopic.new.perform(post_id: 1, sync_exec: true) }.not_to raise_error
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CreateMissingAvatars do
|
||||
RSpec.describe Jobs::CreateMissingAvatars do
|
||||
it "runs correctly without crashing" do
|
||||
Jobs::CreateMissingAvatars.new.execute(nil)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CreateRecentPostSearchIndexes do
|
||||
RSpec.describe Jobs::CreateRecentPostSearchIndexes do
|
||||
subject { described_class.new }
|
||||
|
||||
fab!(:post) do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::CreateUserReviewable do
|
||||
RSpec.describe Jobs::CreateUserReviewable do
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe ::Jobs::DashboardStats do
|
||||
RSpec.describe ::Jobs::DashboardStats do
|
||||
let(:group_message) { GroupMessage.new(Group[:admins].name, :dashboard_problems, limit_once_per: 7.days.to_i) }
|
||||
|
||||
def clear_recently_sent!
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::DeleteReplies do
|
||||
RSpec.describe Jobs::DeleteReplies do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
|
||||
fab!(:topic) { Fabricate(:topic) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::DeleteTopic do
|
||||
RSpec.describe Jobs::DeleteTopic do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
|
||||
fab!(:topic) do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::DisableBootstrapMode do
|
||||
RSpec.describe Jobs::DisableBootstrapMode do
|
||||
|
||||
describe '.execute' do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'excon'
|
||||
|
||||
describe Jobs::EmitWebHookEvent do
|
||||
RSpec.describe Jobs::EmitWebHookEvent do
|
||||
fab!(:post_hook) { Fabricate(:web_hook) }
|
||||
fab!(:inactive_hook) { Fabricate(:inactive_web_hook) }
|
||||
fab!(:post) { Fabricate(:post) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::EnableBootstrapMode do
|
||||
RSpec.describe Jobs::EnableBootstrapMode do
|
||||
|
||||
describe '.execute' do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::EnqueueDigestEmails do
|
||||
RSpec.describe Jobs::EnqueueDigestEmails do
|
||||
|
||||
describe '#target_users' do
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::EnqueueSuspectUsers do
|
||||
RSpec.describe Jobs::EnqueueSuspectUsers do
|
||||
before { SiteSetting.approve_suspect_users = true }
|
||||
|
||||
it 'does nothing when there are no suspect users' do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::ExportCsvFile do
|
||||
RSpec.describe Jobs::ExportCsvFile do
|
||||
|
||||
describe '#execute' do
|
||||
let(:other_user) { Fabricate(:user) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'csv'
|
||||
|
||||
describe Jobs::ExportUserArchive do
|
||||
RSpec.describe Jobs::ExportUserArchive do
|
||||
fab!(:user) { Fabricate(:user, username: "john_doe") }
|
||||
fab!(:user2) { Fabricate(:user) }
|
||||
let(:extra) { {} }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::FeatureTopicUsers do
|
||||
RSpec.describe Jobs::FeatureTopicUsers do
|
||||
it "raises an error without a topic_id" do
|
||||
expect { Jobs::FeatureTopicUsers.new.execute({}) }.to raise_error(Discourse::InvalidParameters)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::GrantAnniversaryBadges do
|
||||
RSpec.describe Jobs::GrantAnniversaryBadges do
|
||||
|
||||
let(:granter) { described_class.new }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::GrantNewUserOfTheMonthBadges do
|
||||
RSpec.describe Jobs::GrantNewUserOfTheMonthBadges do
|
||||
|
||||
let(:granter) { described_class.new }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe ::Jobs::Heartbeat do
|
||||
RSpec.describe ::Jobs::Heartbeat do
|
||||
after do
|
||||
Discourse.disable_readonly_mode
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::IgnoredUsersSummary do
|
||||
RSpec.describe Jobs::IgnoredUsersSummary do
|
||||
before do
|
||||
SiteSetting.ignored_users_count_message_threshold = 1
|
||||
SiteSetting.ignored_users_message_gap_days = 365
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::InvalidateInactiveAdmins do
|
||||
RSpec.describe Jobs::InvalidateInactiveAdmins do
|
||||
fab!(:active_admin) { Fabricate(:admin, last_seen_at: 1.hour.ago) }
|
||||
before { active_admin.email_tokens.update_all(confirmed: true) }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe Jobs::InviteEmail do
|
||||
RSpec.describe Jobs::InviteEmail do
|
||||
|
||||
describe '.execute' do
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user