Sha256: 3f0eaab87ff9bccd3bbaca81c920c8af102b4780e4f31f47369ad4ab371e363e

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'

RSpec.describe ApplicationJob do
  it 'broadcasts success' do
    expect(::ActiveJobChannel::Channel).
      to receive(:broadcast_to).
      with('active_job_channel', status: 'success', job_name: 'ApplicationJob')
    described_class.perform_now
  end

  it 'broadcasts failure' do
    allow_any_instance_of(described_class).
      to receive(:fake).
      and_raise(::StandardError)
    expect(::ActiveJobChannel::Channel).
      to receive(:broadcast_to).
      with('active_job_channel', status: 'failure', job_name: 'ApplicationJob')
    expect { described_class.perform_now }.to raise_error(::StandardError)
  end

  it 'broadcasts the job name' do
    expect(::ActiveJobChannel::Channel).
      to receive(:broadcast_to).
      with('active_job_channel', status: 'success', job_name: 'ApplicationJob')
    described_class.perform_now
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_job_channel-0.0.2 spec/jobs/application_job_spec.rb
active_job_channel-0.0.1 spec/jobs/application_job_spec.rb