Skip to content

Instantly share code, notes, and snippets.

@zaneclaes
Created December 3, 2013 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaneclaes/7764759 to your computer and use it in GitHub Desktop.
Save zaneclaes/7764759 to your computer and use it in GitHub Desktop.
describe "#social_connections" do
before :each do
@target_user = FactoryGirl.create(:user)
@target_user_listing = FactoryGirl.create(:listing, :user => @target_user)
@current_user = FactoryGirl.create(:user)
@relationship = FactoryGirl.create(:relationship, :user => @current_user, :friend => @target_user)
@params = {:id => @target_user.id, :api_version => 'v1'}
end
context 'when logged in as a befriended user' do
it 'lists social connections' do
get :social_connections, api_logged_in_as_user(@params, @current_user)
pp response_json #prints {"connections_count"=>0, "connections"=>[]}
pp @target_user.id #prints 143875
pp @current_user.id #prints 143876
pp @relationship #prints <Relationship id: 1, user_id: 143876, friend_id: 143875, relationship_type: 1, status: 1, privacy_setting: nil, created_at: "2013-12-03 06:04:00", updated_at: "2013-12-03 06:04:00">
response_json['connections_count'].should > 0
response_json['connections'][0].keys.should =~ user_basic_keys
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment