Sha256: 40da6d807af4c1a82b2404e211c5021020ae0369b7ea56b1b0b89b93f743046d

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

# encoding: utf-8
require './test/test_helper'

class ActionSmser::TestArrayTest < ActiveSupport::TestCase
  class MockSms<ActionSmser::Base
    def basic_sms(to, from, body)
      sms(:to => to, :from => from, :body => body)
    end
  end

  setup do
    @receivers = ["555123555", "123555123"]
    @sender = "555666"
    @body = "Body with ääkköset end"
    @sms = MockSms.basic_sms(@receivers, @sender, @body)

    @sms.delivery_options[:delivery_method] = :test_array
    assert_equal ActionSmser::DeliveryMethods::TestArray, @sms.delivery_method, "cant run tests, wrong delivery method"
    ActionSmser::DeliveryMethods::TestArray.deliveries.clear

    @sms_delivery = @sms.deliver
  end

  test "should be able to deliver" do
    assert @sms_delivery
  end

  test "should add to TestArray" do
    assert_equal 1, ActionSmser::DeliveryMethods::TestArray.deliveries.size
    assert_equal @sms, ActionSmser::DeliveryMethods::TestArray.deliveries.first
  end

  test "with saving delivery_reports" do
    ActionSmser::DeliveryMethods::TestArray.deliveries.clear
    @sms.delivery_options[:save_delivery_reports] = true
    @delivery_reports_count = ActionSmser::DeliveryReport.count
    @sms_delivery = @sms.deliver

    assert_equal @delivery_reports_count + 2, ActionSmser::DeliveryReport.count
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
action_smser-3.4.1 test/unit/action_smser/delivery_methods/test_array_test.rb
action_smser-3.4.0 test/unit/action_smser/delivery_methods/test_array_test.rb
action_smser-3.3.0 test/unit/action_smser/delivery_methods/test_array_test.rb
action_smser-3.2.0 test/unit/action_smser/delivery_methods/test_array_test.rb