Skip to content

Commit

Permalink
Refactor async messenger spec
Browse files Browse the repository at this point in the history
  • Loading branch information
t0ggah committed May 13, 2015
1 parent 2c0ebc1 commit a5671a6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions spec/cellular/jobs/async_messenger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
let(:sms_stub) { double "SMS", deliver: true }
let(:sms_options) { { "recipient" => "12345678", "text" => "Foo" } }

before do
allow(Cellular::SMS).to receive(:new).and_return sms_stub
end

it 'creates a new SMS object' do
symbolized_sms_options = { recipient: "12345678", text: "Foo" }

expect(Cellular::SMS).to receive(:new)
.with(symbolized_sms_options)
.and_return sms_stub

subject.perform sms_options

expect(Cellular::SMS).to have_received(:new)
.with(symbolized_sms_options)
end

it "delivers the SMS" do
allow(Cellular::SMS).to receive(:new).and_return sms_stub

expect(sms_stub).to receive :deliver

subject.perform sms_options

expect(sms_stub).to have_received :deliver
end
end

0 comments on commit a5671a6

Please sign in to comment.