Sha256: 62472bc23fcc6388ed4049751f626cf8bf7469f86d8e4621113880741695a91a

Contents?: true

Size: 1008 Bytes

Versions: 2

Compression:

Stored size: 1008 Bytes

Contents

require 'spec_helper'

describe Cellular::Backends::Log do

  let(:recipient) { '47xxxxxxxx' }
  let(:sender)    { 'Custom sender' }
  let(:message)   { 'This is an SMS message' }
  let(:price)     { 100 }
  let(:country)   { 'NO '}

  let(:options) {
    {
      recipient: recipient,
      sender: sender,
      message: message,
      price: price
    }
  }

  before do
    # mock rails, we're pretending we're in a rails env
    rails = Class.new
    def rails.logger
      @logger ||= Cellular::Logger.new
    end
    Object.const_set(:Rails, rails)
    
    Cellular.config.username = 'username'
    Cellular.config.password = 'password'
    Cellular.config.delivery_url = nil
    Cellular.config.logger = nil # so it will autowire
  end
  
  after do
    Object.send :remove_const, :Rails
  end

  describe '::deliver' do
    let(:deliveries) { Cellular.deliveries }

    it 'logs the message' do
      expect(Rails.logger).to receive(:info)
      described_class.deliver(options)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cellular-2.1.0 spec/cellular/backends/log_with_rails_spec.rb
cellular-2.0.0 spec/cellular/backends/log_with_rails_spec.rb