1
0
Fork 0
discourse-custom-wizard-unl.../spec/jobs/update_notices_spec.rb

30 Zeilen
821 B
Ruby

2021-09-24 11:58:42 +02:00
# frozen_string_literal: true
require_relative '../plugin_helper'
describe Jobs::CustomWizardUpdateNotices do
let(:subscription_message) {
{
message: "Message about subscription",
type: "info",
created_at: Time.now - 3.day,
expired_at: nil
}
}
let(:plugin_status) {
{
name: 'discourse-custom-wizard',
status: 'incompatible',
status_changed_at: Time.now - 3.day
}
}
it "updates the notices" do
2021-11-02 08:29:31 +01:00
stub_request(:get, CustomWizard::Notice.subscription_message_url).to_return(status: 200, body: { messages: [subscription_message] }.to_json)
2021-11-02 08:39:38 +01:00
stub_request(:get, CustomWizard::Notice.plugin_status_url).to_return(status: 200, body: plugin_status.to_json)
2021-09-24 11:58:42 +02:00
described_class.new.execute
expect(CustomWizard::Notice.list.length).to eq(2)
end
end