Sha256: 486bf6f34a430b560571e58031731046a80185bb4dfa3f5d935841c8c0032311

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 Bytes

Contents

# encoding: utf-8

shared_examples_for 'all invocations' do
  it { should eql(response) }

  it 'indicates success via #success?' do
    expect(subject.success?).to be(success_status)
  end

  it 'provides the processed input in Response#input' do
    expect(subject.input).to eql(processed_input)
  end
end

shared_examples_for 'an action invocation' do
  it_behaves_like 'all invocations'

  it 'notifies all observers' do
    expect(Demo::Core::Observers::LOG_EVENT).to receive(:call).with(action_response).ordered
    expect(Demo::Core::Observers::SEND_EMAIL).to receive(:call).with(action_response).ordered
    subject
  end
end

shared_examples_for 'no action invocation' do
  let(:success_status) { false }

  it_behaves_like 'all invocations'

  it 'does not notify any observers' do
    expect(Demo::Core::Observers::LOG_EVENT).to_not receive(:call)
    expect(Demo::Core::Observers::SEND_EMAIL).to_not receive(:call)
    subject
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
substation-0.0.11 spec/shared/examples/integration/demo.rb
substation-0.0.10 spec/shared/examples/integration/demo.rb