Sha256: 44806ae492f3caa662565182630844a6790bdc9aa0d3ad0d13a2d347ff06b3dc
Contents?: true
Size: 1.09 KB
Versions: 8
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true describe PUNK::SendSmsWorker do let(:to) { generate(:phone) } let(:body) { Faker::Lorem.sentence } before do PUNK.cache.delete(:plivo) end it "is valid with valid attributes" do expect { described_class.perform_async(to: to, body: body) }.to change(described_class.jobs, :size).by(1) expect { described_class.drain }.not_to raise_error end it "is invalid without a to number" do expect { described_class.perform_async(body: body) }.to change(described_class.jobs, :size).by(1) expect { described_class.drain }.to raise_error(PUNK::BadRequest, "validation failed") end it "is invalid without a message body" do expect { described_class.perform_async(to: to) }.to change(described_class.jobs, :size).by(1) expect { described_class.drain }.to raise_error(PUNK::BadRequest, "validation failed") end it "sends an sms" do described_class.perform_async(to: to, body: body) described_class.drain sms = PUNK.cache.get(:plivo).first expect(sms[:from]).to eq(PUNK.get.plivo.number) expect(sms[:body]).to eq(body) end end
Version data entries
8 entries across 8 versions & 1 rubygems