require 'ostruct' require 'iremix/user' module Iremix describe User do describe ".current" do it "returns the user" do token = OpenStruct.new(:token => '123abc') response = OpenStruct.new(:parsed => {"id"=>31637, "first_name"=>"nick", "last_name"=>"nick", "name"=>"nick", "email"=>"nick@neotericdesign.com", "profile_photo"=>nil, "created_at"=>"2012-04-23T14:41:20-05:00", "updated_at"=>"2012-05-04T09:28:56-05:00", "status"=>200}) token.should_receive(:get) .with('/api/v1/people/current.json', :params => { :access_token => '123abc' }) .and_return(response) Iremix::User.current(token).id.should == 31637 end end end end