heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
24.03k stars 5.55k forks source link

oauth2 test helper problem #569

Closed fschwahn closed 14 years ago

fschwahn commented 14 years ago

Hi, I'm not quite sure this is a bug in devise, or a bug at all, but I couldn't find any information on this one. I am using rails 3.0.0 with devise master and have set up an authentication via oauth2 with facebook. I practically followed this tutorial: http://www.stjhimy.com/posts/14-allowing-devise-login-with-facebook-account

Now I wanted to write a test for this behavior, so I looked into the "OAuth2: Testing"-wiki page. I'm using cucumber, and have written the following hook:

ACCESS_TOKEN = {
  :access_token => "fbapp"
}

FACEBOOK_INFO = {
  :first_name  => 'Hans',
  :last_name  => 'Wurst',
  :id => '123',
  :link => "http://facebook.com/hanswurst", 
  :email => 'hanswurst@example.com'
}

Before('@oauth') do
  Devise::Oauth.short_circuit_authorizers!
  Devise::Oauth.stub!(:facebook) do |b|
    b.post('/oauth/access_token') { [200, {}, ACCESS_TOKEN.to_json] }
    b.post('https://graph.facebook.com/me?') { [200, {}, FACEBOOK_INFO.to_json] }
  end
end

After('@oauth') do
  Devise::Oauth.unshort_circuit_authorizers!
  Devise::Oauth.reset_stubs!
end

I also added this to env.rb:

Devise::Oauth.test_mode!

Now, when I run the feature I get the following error:

undefined method `request_uri' for #<Faraday::Adapter::Test:0x105798ac8> (NoMethodError)
./app/models/user.rb:11:in `find_for_facebook_oauth'
./features/step_definitions/web_steps.rb:35
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:34:in `/^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/'
features/facebook_account.feature:9:in `When I follow "Melden Sie sich mit Ihrem Facebook Account an"'

I tried to look into Faraday and the Devise::Oauth.stub!-method, but it was beyond me.

Best regards, Fabian

josevalim commented 14 years ago

Try giving a path instead of a full uri here:

b.post('https://graph.facebook.com/me?')

fschwahn commented 14 years ago

I tried this as well, results in the same error.

josevalim commented 14 years ago

Hrm, so I don't know. What is in your user model, around line 11 as shown in the backtrace? Which faraday and oauth 2 versons are you using?

fschwahn commented 14 years ago

This is in line 11 of the user model:

    data = ActiveSupport::JSON.decode(access_token.get('https://graph.facebook.com/me?'))

These are my gem versions:

faraday (0.5.0)
oauth2 (0.1.0)
josevalim commented 14 years ago

You should also pass a relative path there, no?

fschwahn commented 14 years ago

ok, I replaced all the absolute paths 'https://graph.facebook.com/me?' with the relative path '/me?', but I'm still getting the same error.

josevalim commented 14 years ago

Not sure if /me? is a valid request uri path. Or it is /me or /me?something=foo.

fschwahn commented 14 years ago

I just read the Facebook documentation, and you are right, the path is supposed to be '/me', I didn't really think about it and just copied it from the tutorial I posted above. So I did change the code, but the error remains. I don't know if I was unclear about it before, but the authentication with Facebook actually works in development mode, just the tests are failing.

josevalim commented 14 years ago

Interesting. Could you please go to config/initializers/backtrace_silencers and uncomment the line that remove_silencers! ? This will allow the full backtrace to appear. Then could you please post the backtrace here?

fschwahn commented 14 years ago

I did what you said, but the backtrace didn't change...?

josevalim commented 14 years ago

Really? So maybe cucumber is cleaning up the backtrace. :( Hard to detect from where the error is coming from then.

fschwahn commented 14 years ago

Yeah, I had to start cucumber with the following parameter: --backtrace --verbose

undefined method `request_uri' for #<Faraday::Adapter::Test:0x10584ac28> (NoMethodError)
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/faraday-0.5.0/lib/faraday/adapter/test.rb:115:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/faraday-0.5.0/lib/faraday/request.rb:84:in `run'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/faraday-0.5.0/lib/faraday/request.rb:26:in `run'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/faraday-0.5.0/lib/faraday/connection.rb:169:in `run_request'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/oauth2-0.1.0/lib/oauth2/client.rb:59:in `request'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/oauth2-0.1.0/lib/oauth2/access_token.rb:19:in `request'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/oauth2-0.1.0/lib/oauth2/access_token.rb:23:in `get'
/Users/fabian/code/rails/suedseetraum/app/models/user.rb:14:in `find_for_facebook_oauth'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/bundler/gems/devise-8539f5f91592/lib/devise/oauth/internal_helpers.rb:115:in `send'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/bundler/gems/devise-8539f5f91592/lib/devise/oauth/internal_helpers.rb:115:in `facebook'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/abstract_controller/base.rb:150:in `process_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_controller/metal/rendering.rb:11:in `process_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/abstract_controller/callbacks.rb:18:in `process_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:450:in `_run__817170346__process_action__2120514126__callbacks'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:409:in `send'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:93:in `send'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:93:in `run_callbacks'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/abstract_controller/callbacks.rb:17:in `process_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/notifications.rb:52:in `instrument'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/notifications.rb:52:in `instrument'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_controller/metal/rescue.rb:17:in `process_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-rails-0.3.2/lib/cucumber/rails/action_controller.rb:13:in `process_action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/abstract_controller/base.rb:119:in `process'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/abstract_controller/rendering.rb:40:in `process'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_controller/metal.rb:133:in `dispatch'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_controller/metal.rb:173:in `action'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/routing/route_set.rb:62:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/routing/route_set.rb:27:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/routing/mapper.rb:34:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-mount-0.6.13/lib/rack/mount/route_set.rb:148:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-mount-0.6.13/lib/rack/mount/code_generation.rb:93:in `recognize'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-mount-0.6.13/lib/rack/mount/code_generation.rb:68:in `optimized_each'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-mount-0.6.13/lib/rack/mount/code_generation.rb:92:in `recognize'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-mount-0.6.13/lib/rack/mount/route_set.rb:139:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/routing/route_set.rb:492:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/warden-1.0.1/lib/warden/manager.rb:35:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/warden-1.0.1/lib/warden/manager.rb:34:in `catch'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/warden-1.0.1/lib/warden/manager.rb:34:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/head.rb:14:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-1.2.1/lib/rack/methodoverride.rb:24:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/flash.rb:182:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/cookies.rb:287:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activerecord-3.0.0/lib/active_record/query_cache.rb:32:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activerecord-3.0.0/lib/active_record/query_cache.rb:12:in `cache'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activerecord-3.0.0/lib/active_record/query_cache.rb:31:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/callbacks.rb:46:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-1.2.1/lib/rack/sendfile.rb:107:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/railties-3.0.0/lib/rails/rack/logger.rb:13:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-1.2.1/lib/rack/runtime.rb:17:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/activesupport-3.0.0/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-1.2.1/lib/rack/lock.rb:11:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-1.2.1/lib/rack/lock.rb:11:in `synchronize'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-1.2.1/lib/rack/lock.rb:11:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/actionpack-3.0.0/lib/action_dispatch/middleware/static.rb:30:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/railties-3.0.0/lib/rails/application.rb:168:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-1.2.1/lib/rack/urlmap.rb:47:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `each'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-test-0.5.6/lib/rack/mock_session.rb:30:in `request'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-test-0.5.6/lib/rack/test.rb:209:in `process_request'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/rack-test-0.5.6/lib/rack/test.rb:57:in `get'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/capybara-0.3.9/lib/capybara/driver/rack_test_driver.rb:242:in `get'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/capybara-0.3.9/lib/capybara/driver/rack_test_driver.rb:203:in `send'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/capybara-0.3.9/lib/capybara/driver/rack_test_driver.rb:203:in `process'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/capybara-0.3.9/lib/capybara/driver/rack_test_driver.rb:85:in `click_without_javascript_emulation'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-rails-0.3.2/lib/cucumber/rails/capybara_javascript_emulation.rb:15:in `click'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/capybara-0.3.9/lib/capybara/session.rb:51:in `click_link'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/capybara-0.3.9/lib/capybara/dsl.rb:55:in `click_link'
/Users/fabian/code/rails/suedseetraum/features/step_definitions/web_steps.rb:35
/Users/fabian/code/rails/suedseetraum/features/step_definitions/web_steps.rb:14:in `with_scope'
/Users/fabian/code/rails/suedseetraum/features/step_definitions/web_steps.rb:34
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/core_ext/instance_exec.rb:48:in `cucumber_instance_exec'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/rb_support/rb_step_definition.rb:54:in `invoke'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/step_match.rb:26:in `invoke'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/step_invocation.rb:63:in `invoke'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/step_invocation.rb:42:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:99:in `visit_step'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:98:in `visit_step'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/step_collection.rb:15:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/step_collection.rb:14:in `each'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/step_collection.rb:14:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:93:in `visit_steps'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:92:in `visit_steps'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/scenario.rb:53:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime.rb:127:in `with_hooks'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime.rb:143:in `before_and_after'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime.rb:126:in `with_hooks'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime/support_code.rb:98:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime/support_code.rb:98:in `around'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/language_support/language_methods.rb:13:in `around'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/language_support/language_methods.rb:95:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/language_support/language_methods.rb:95:in `execute_around'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/language_support/language_methods.rb:12:in `around'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime/support_code.rb:97:in `around'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime/support_code.rb:95:in `call'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime/support_code.rb:95:in `around'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime.rb:138:in `around'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime.rb:125:in `with_hooks'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/scenario.rb:51:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/scenario.rb:106:in `with_visitor'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/scenario.rb:45:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:51:in `visit_feature_element'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/feature.rb:35:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/feature.rb:34:in `each'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/feature.rb:34:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:20:in `visit_feature'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:19:in `visit_feature'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/features.rb:29:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/features.rb:17:in `each'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/features.rb:17:in `each'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/features.rb:28:in `accept'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:14:in `visit_features'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/ast/tree_walker.rb:13:in `visit_features'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/runtime.rb:32:in `run!'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/cli/main.rb:54:in `execute!'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/../lib/cucumber/cli/main.rb:29:in `execute'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/gems/cucumber-0.9.2/bin/cucumber:8
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/bin/cucumber:19:in `load'
/Users/fabian/.rvm/gems/ruby-1.8.7-p302@suedseetraum/bin/cucumber:19
features/facebook_account.feature:9:in `When I follow "Melden Sie sich mit Ihrem Facebook Account an"'
josevalim commented 14 years ago

Hrm, seems like faraday bug.

josevalim commented 14 years ago

Yeah, it is a bug here:

http://github.com/technoweenie/faraday/blob/master/lib/faraday/adapter/test.rb#L115

fschwahn commented 14 years ago

I was actually able to solve the problem. After seeing the complete stacktrace I could see that the problem was that faraday couldn't find a matching stub. The error message was just screwed up, so I had no idea where the problem actually was.

I have changed the stub to this:

Before('@oauth') do
  Devise::Oauth.short_circuit_authorizers!
  Devise::Oauth.stub!(:facebook) do |b|
    b.post('/oauth/access_token') { [200, {}, ACCESS_TOKEN.to_json] }
    b.get('/me?access_token=suedseetraum') { [200, {}, FACEBOOK_INFO.to_json] }
  end
end

Thanks for your quick help!

josevalim commented 14 years ago

Fixed here:

http://github.com/josevalim/faraday

Feel free to use it in your Gemfile until it is fixed in Faraday.

fschwahn commented 14 years ago

Great! Thanks again.