Sha256: 1612fc09544e9f2ce5119327fb97520582c72902cd0e86a6e7a5a4b1acdfbb47

Contents?: true

Size: 1.45 KB

Versions: 5

Compression:

Stored size: 1.45 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class NotificationTest < Test::Unit::TestCase #:nodoc: all
  context "A recording" do
    setup do
      Twilio.connect('mysid', 'mytoken')
    end

    should "be retrievable as a list" do
      fake_response = fixture(:notifications)
      FakeWeb.register_uri(:get, twilio_url('Notifications'), :string => fake_response)
      assert_equal Twilio::Notification.list, fake_response
    end
    
    should "be retrievable individually" do
      fake_response = fixture(:notification)
      FakeWeb.register_uri(:get, twilio_url('Notifications/NO1fb7086ceb85caed2265f17d7bf7981c'), :string => fake_response)
      assert_equal Twilio::Notification.get('NO1fb7086ceb85caed2265f17d7bf7981c'), fake_response
    end
    
    should "be deleted" do
      FakeWeb.register_uri(:delete, twilio_url('Notifications/NO1fb7086ceb85caed2265f17d7bf7981c'), :status => [ 204, "HTTPNoContent" ])
      assert Twilio::Notification.delete('NO1fb7086ceb85caed2265f17d7bf7981c')
    end
    
    context "using deprecated API" do
      setup do
        @connection = Twilio::Connection.new('mysid', 'mytoken')
        @notification = Twilio::Notification.new(@connection)
      end

      should "be retrievable as a list" do
        fake_response = fixture(:notifications)
        FakeWeb.register_uri(:get, twilio_url('Notifications'), :string => fake_response)
        assert_equal @notification.list, fake_response
      end
    end
    
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
dancroak-twilio-2.3.1 test/twilio/notification_test.rb
webficient-twilio-2.3.0 test/twilio/notification_test.rb
webficient-twilio-2.4.0 test/twilio/notification_test.rb
twilio-2.4.0 test/twilio/notification_test.rb
twilio-2.3.0 test/twilio/notification_test.rb