Sha256: 5bc61a63ea4f92cff738c5f2c5826448fcd38a1f5525833b1834c6dd4d591043

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

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

describe "Transmitter" do
  
  before(:all) do
    @trumpet = Trumpet::Base.new :username => "somedude", :password => "somepassword"
    
    FakeWeb.register_uri :post,   "#{AUTHENTICATED_URI}/transmitters",            :file => "#{File.dirname(__FILE__)}/fixtures/transmitters/create"
    FakeWeb.register_uri :get,    "#{AUTHENTICATED_URI}/transmitters/1",          :file => "#{File.dirname(__FILE__)}/fixtures/transmitters/find"
    FakeWeb.register_uri :delete, "#{AUTHENTICATED_URI}/transmitters/1",           :string => ["204", "OK"]
    FakeWeb.register_uri :post,   "#{AUTHENTICATED_URI}/transmitters/1/messages",  :string => ["204", "OK"]
  end
  
  it "should let me create a transmitter" do
    transmitter = @trumpet.transmitters.create :tags => 'dudes, gnarly, rad'
    transmitter.tags.should == 'dudes, gnarly, rad'
  end
  
  it "should let me delete a transmitter" do
    transmitter = @trumpet.transmitters.find(1)
    transmitter.tags.should == 'dudes, gnarly, rad'
  end
  
  it "should let me broadcast a message into a receiver" do
    transmitter = @trumpet.transmitters.find(1)
    transmitter.broadcast(Trumpet::Message.new(:content => 'dude, awesome')).should == true
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

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