publish_scheduled_status_worker_spec.rb 586 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe PublishScheduledStatusWorker do
  4. subject { described_class.new }
  5. let(:scheduled_status) { Fabricate(:scheduled_status, params: { text: 'Hello world, future!' }) }
  6. describe 'perform' do
  7. before do
  8. subject.perform(scheduled_status.id)
  9. end
  10. it 'creates a status' do
  11. expect(scheduled_status.account.statuses.first.text).to eq 'Hello world, future!'
  12. end
  13. it 'removes the scheduled status' do
  14. expect(ScheduledStatus.find_by(id: scheduled_status.id)).to be_nil
  15. end
  16. end
  17. end