spec/cellular/models/sms_spec.rb in cellular-2.1.0 vs spec/cellular/models/sms_spec.rb in cellular-2.2.0

- old
+ new

@@ -1,14 +1,13 @@ require 'spec_helper' describe Cellular::SMS do - let(:recipient) { '47xxxxxxxx' } let(:sender) { 'Custom sender' } let(:message) { 'This is an SMS message' } let(:price) { 100 } - let(:country_code) { 'NO'} + let(:country_code) { 'NO' } let(:recipients) { nil } subject do described_class.new( recipients: recipients, @@ -23,44 +22,44 @@ before do Cellular.config.backend = Cellular::Backends::Sendega end describe '#initialize' do - it{ expect(subject.recipient).to eq recipient } - it{ expect(subject.sender).to eq sender } - it{ expect(subject.message).to eq message } - it{ expect(subject.price).to eq price } - it{ expect(subject.country_code).to eq country_code } + it { expect(subject.recipient).to eq recipient } + it { expect(subject.sender).to eq sender } + it { expect(subject.message).to eq message } + it { expect(subject.price).to eq price } + it { expect(subject.country_code).to eq country_code } it { should_not be_delivered } context 'when sender omitted' do before do Cellular.config.sender = 'Hyper' end subject { described_class.new } - it{ expect(subject.sender).to eq 'Hyper' } + it { expect(subject.sender).to eq 'Hyper' } end context 'when price omitted' do before do Cellular.config.price = 5 end subject { described_class.new } - it{ expect(subject.price).to be 5 } + it { expect(subject.price).to be 5 } end context 'when country omitted' do before do Cellular.config.country_code = 'NL' end subject { described_class.new } - it{ expect(subject.country_code).to eq 'NL'} + it { expect(subject.country_code).to eq 'NL' } end end describe '#deliver' do before do @@ -78,24 +77,25 @@ subject.deliver expect(subject).to be_delivered end end - describe "#deliver_async" do - it "makes ActiveJob schedule an SMS job" do + describe '#deliver_async' do + it 'makes ActiveJob schedule an SMS job' do sms_options = { - receiver: "12345678", - message: "Test SMS" + receiver: '12345678', + message: 'Test SMS' } wait = 100 expect_any_instance_of(ActiveJob::ConfiguredJob) .to receive(:perform_later) .with(sms_options) sms = Cellular::SMS.new sms_options - allow(ActiveJob::Base).to receive(:queue_adapter).and_return ActiveJob::QueueAdapters::TestAdapter.new + allow(ActiveJob::Base).to receive(:queue_adapter) + .and_return ActiveJob::QueueAdapters::TestAdapter.new allow(sms).to receive(:options).and_return sms_options sms.deliver_async(wait: wait) end end