Sha256: 6584cd42e383233a5082ce9222e2ffc64a6d3cb298ad277e1099264bc5daa8d0

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

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

describe "Resource" do
  
  before(:all) do
    @trumpet = Trumpet::Base.new :username => 'somedude', :password => 'somepassword'
    
    FakeWeb.register_uri :get,  "#{AUTHENTICATED_URI}/channels/radical",  :file => "#{File.dirname(__FILE__)}/fixtures/channels/show"
    
    @channel_attributes = {
      :receiver_id  => 2,   :name           => "radical", 
      :updated_at   => nil, :description    => nil, 
      :owner_id     => 1,   :transmitter_id => 2, 
      :created_at   => nil
    }
  end
  
  it "should build up attr_readers from all passed in attributes" do
    channel = @trumpet.channels.find 'radical'
     
    # Verify that all methods are there and all values are set properly
    @channel_attributes.keys.each do |attribute|
      channel.send(attribute).should == @channel_attributes[attribute]
    end
  end
  
  it "should properly convert itself into a hash" do
    channel = @trumpet.channels.find 'radical'  
    channel.to_h.should == @channel_attributes
  end
  
  it "should exclude credentials from inspect" do
    channel = @trumpet.channels.find 'radical'
    channel.inspect.should_not include('@credentials')
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trumpet-trumpet-0.1.4 spec/resource_spec.rb