spec/cellular/models/sms_spec.rb in cellular-1.1.0 vs spec/cellular/models/sms_spec.rb in cellular-1.2.0
- old
+ new
@@ -4,11 +4,11 @@
let(:recipient) { '47xxxxxxxx' }
let(:sender) { 'Custom sender' }
let(:message) { 'This is an SMS message' }
let(:price) { 100 }
- let(:country) { 'NO '}
+ let(:country) { 'NO'}
subject do
described_class.new(
recipient: recipient,
sender: sender,
@@ -28,9 +28,39 @@
its(:message) { should eq message }
its(:price) { should eq price }
its(:country) { should eq country }
it { should_not be_delivered }
+
+ context 'when sender omitted' do
+ before do
+ Cellular.config.sender = 'Hyper'
+ end
+
+ subject { described_class.new }
+
+ its(:sender) { should eq 'Hyper' }
+ end
+
+ context 'when price omitted' do
+ before do
+ Cellular.config.price = 5
+ end
+
+ subject { described_class.new }
+
+ its(:price) { should eq 5 }
+ end
+
+ context 'when country omitted' do
+ before do
+ Cellular.config.country_code = 'NL'
+ end
+
+ subject { described_class.new }
+
+ its(:country) { should eq 'NL' }
+ end
end
describe '#deliver' do
before do
expect(Cellular::Backends::Sendega).to receive(:deliver).with(