Sha256: 3ecd75299368a17732ddf6b8fb1233ecce758cf0ff0c146cce12bb543c727744

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

require 'spec_helper'

RSpec.describe ApplicationJob do
  it 'broadcasts success' do
    expect(ActionCable.server).
      to receive(:broadcast).
      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(ActionCable.server).
      to receive(:broadcast).
      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(ActionCable.server).
      to receive(:broadcast).
      with('active_job_channel', status: 'success', job_name: 'ApplicationJob')
    described_class.perform_now
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_job_channel-0.0.3 spec/jobs/application_job_spec.rb