Sha256: 05e3febbb31dc2c9e83d70ad1196ecd69aa0d065bd5a92aa4621d0900dccf4db

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'

describe Tinder::Campfire do
  before do
    @campfire = Tinder::Campfire.new('test', :token => 'mytoken')
  end
  
  describe "rooms" do
    before do
      FakeWeb.register_uri(:get, "https://mytoken:X@test.campfirenow.com/rooms.json",
        :body => fixture('rooms.json'), :content_type => "application/json")
    end
    
    it "should return rooms" do
      @campfire.rooms.size.should == 2
      @campfire.rooms.first.should be_kind_of(Tinder::Room)
    end
    
    it "should set the room name and id" do
      room = @campfire.rooms.first
      room.name.should == 'Room 1'
      room.id.should == 80749
    end
  end
  
  describe "users" do
    before do
      FakeWeb.register_uri(:get, "https://mytoken:X@test.campfirenow.com/rooms.json",
        :body => fixture('rooms.json'), :content_type => "application/json")
      [80749, 80751].each do |id|
        FakeWeb.register_uri(:get, "https://mytoken:X@test.campfirenow.com/room/#{id}.json",
        :body => fixture("rooms/room#{id}.json"), :content_type => "application/json")
      end
    end
    
    it "should return a sorted list of users in all rooms" do
      @campfire.users.length.should == 2
      @campfire.users.first[:name].should == "Jane Doe"
      @campfire.users.last[:name].should == "John Doe"
    end
  end
  
  describe "me" do
    before do
      FakeWeb.register_uri(:get, "https://mytoken:X@test.campfirenow.com/users/me.json",
        :body => fixture('users/me.json'), :content_type => "application/json")
    end
    
    it "should return the current user's information" do
      @campfire.me["name"].should == "John Doe"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tinder-1.4.1 spec/tinder/campfire_spec.rb