You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/spec/services/asciicast_creator_spec.rb

35 lines
708 B
Ruby

require 'rails_helper'
describe AsciicastCreator do
let(:creator) { described_class.new }
describe '#create' do
subject { creator.create(attributes) }
let(:attributes) { { a: 'A' } }
let(:asciicast) { stub_model(Asciicast, id: 666) }
before do
allow(Asciicast).to receive(:create!) { asciicast }
end
it 'calls Asciicast.create! with proper attributes' do
subject
expect(Asciicast).to have_received(:create!).with(attributes)
end
it 'enqueues a post-processing job' do
subject
expect(AsciicastWorker).to have_queued_job(666)
end
it 'returns the created asciicast' do
expect(subject).to be(asciicast)
end
end
end