Getting HTTP 406 when trying to test facebooker application with cucumber
Posted
by Waseem
on Stack Overflow
See other posts from Stack Overflow
or by Waseem
Published on 2010-05-23T12:00:09Z
Indexed on
2010/05/23
12:00 UTC
Read the original article
Hit count: 406
I am trying to test facebook api calls with cucumber. Here is the code.
# app/controller/facebook_users_controller.rb
class FacebookUsersController < ApplicationController
def create
fb_user = facebook_session.user
user = User.new(:facebook_uid => fb_user.uid, :facebook_session_key => facebook_session.session_key
respond_to do |format|
if user.save
format.json { render :json => { :status => 'ok' }.to_json }
end
end
end
end
# features/steps/facebook_connect_step.rb
Given /^I am a facebook connected user$/ do
mock_session = Facebooker::MockSession.create
post('/facebook_user.json')
puts response.code
end
When I run the cucumber step for above step definition, I get a response code of 406 instead of 200. This happens in the cucumber test environment only and not in the browser(development/production).
© Stack Overflow or respective owner