Sha256: 2e416a91532364c40e9e908958cc591883653f5d552652962bd995d8526959b4

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe "Receiver" do
  
  before(:all) do
    @trumpet = Trumpet::Base.new :username => "somedude", :password => "somepassword"
    
    FakeWeb.register_uri :post,   "#{AUTHENTICATED_URI}/receivers",             :file => "#{File.dirname(__FILE__)}/fixtures/receivers/create"
    FakeWeb.register_uri :get,    "#{AUTHENTICATED_URI}/receivers/1",           :file => "#{File.dirname(__FILE__)}/fixtures/receivers/find"
    FakeWeb.register_uri :delete, "#{AUTHENTICATED_URI}/receivers/1",           :string => ["204", "OK"]
    FakeWeb.register_uri :get,    "#{AUTHENTICATED_URI}/receivers/1/messages",  :file => "#{File.dirname(__FILE__)}/fixtures/receivers/messages"
  end
  
  it "should let me create a receiver" do
    receiver = @trumpet.receivers.create
    receiver.name.should == "Everything "  
  end
  
  it "should let me find an existing receiver" do
    receiver = @trumpet.receivers.find(1)
    receiver.name.should == "Everything "
  end
  
  it "should let me delete an existing receiver" do
    receiver = @trumpet.receivers.find(1)
    receiver.delete.should == true
  end
  
  it "should let me fetch all of the messages for a given receiver" do
    receiver = @trumpet.receivers.find(1)
    messages = receiver.messages
    messages.length.should == 1
    messages.first.content.should == 'yay'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trumpet-trumpet-0.1.0 spec/receiver_spec.rb
trumpet-trumpet-0.1.1 spec/receiver_spec.rb
trumpet-trumpet-0.1.2 spec/receiver_spec.rb
trumpet-trumpet-0.1.3 spec/receiver_spec.rb
trumpet-trumpet-0.1.4 spec/receiver_spec.rb