我正面临一个错误,试图配置omniauth进行集成测试的目的与黄瓜(我设置Omniauth通过Devise维基提供)
请看下面:
Scenario: Test # features/omniauth.feature:3 Given I am signed in with facebook # features/step_definitions/omniauth_steps.rb:1 bad component(expected host component): http://www.example.com (URI::InvalidComponentError) /Users/benoit/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/uri/generic.rb:395:in `check_host' /Users/benoit/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/uri/generic.rb:409:in `host=' ./features/step_definitions/omniauth_steps.rb:2:in `/^I am signed in with facebook$/' features/omniauth.feature:4:in `Given I am signed in with facebook' Then I open the page # features/step_definitions/debug_steps.rb:5omniauth.feature
Feature: OmniAuth Scenario: Test Given I am signed in with facebook Then I open the pageomniauth_steps.rb
Given /^I am signed in with facebook$/ do visit "/auth/facebook" end支持/ env.rb
OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:facebook] = { 'uid' => '12345', "user_info" => { "email" => "foobar@example.com", "first_name" => "foo", "last_name" => "Bar" } }初始化/ devise.rb
case when Rails.env.production? config.omniauth :facebook, 'XXXX', 'XXXX', {:scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}} when Rails.env.development? config.omniauth :facebook, 'XXXX', 'XXXX' when Rails.env.test? config.omniauth :facebook, 'XXXX', 'XXXX' OmniAuth.config.full_host = 'http://example.com' # issue 257 end路线
devise_scope :user do get '/auth/:provider' => 'users/omniauth_callbacks#passthru' end devise_for :users, :path => "", :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }omniauth.feature
Feature: OmniAuth Scenario: Test Given I am signed in with facebook Then I open the pageomniauth_steps.rb
Given /^I am signed in with facebook$/ do visit "/auth/facebook" endsupport/env.rb
OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:facebook] = { 'uid' => '12345', "user_info" => { "email" => "foobar@example.com", "first_name" => "foo", "last_name" => "Bar" } }initializer/devise.rb
case when Rails.env.production? config.omniauth :facebook, 'XXXX', 'XXXX', {:scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}} when Rails.env.development? config.omniauth :facebook, 'XXXX', 'XXXX' when Rails.env.test? config.omniauth :facebook, 'XXXX', 'XXXX' OmniAuth.config.full_host = 'http://example.com' # issue 257 endroutes
devise_scope :user do get '/auth/:provider' => 'users/omniauth_callbacks#passthru' end devise_for :users, :path => "", :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }As info, I also configured my facebook test_app with the following URL: http://example.com/
I would be pleased to know if someone has a thought/experienced this. Thank you!
最满意答案
尝试添加:
Before do Capybara.default_host = 'example.com' end到您的支持/ env.rb文件,请尝试注释掉:
OmniAuth.config.full_host = 'http://example.com' # issue 257从您的初始化程序/ devise.rb文件。
try to add :
Before do Capybara.default_host = 'example.com' endto your support/env.rb file, try also commenting out :
OmniAuth.config.full_host = 'http://example.com' # issue 257from your initializer/devise.rb file.
Rails / Cucumber - 托管错误测试omniauth(provider:facebook) - (URI :: InvalidComponentError)(Rails/Cucumber - Hosting error testing omniauth (provider: facebook) - (URI::InvalidComponentError))我正面临一个错误,试图配置omniauth进行集成测试的目的与黄瓜(我设置Omniauth通过Devise维基提供)
请看下面:
Scenario: Test # features/omniauth.feature:3 Given I am signed in with facebook # features/step_definitions/omniauth_steps.rb:1 bad component(expected host component): http://www.example.com (URI::InvalidComponentError) /Users/benoit/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/uri/generic.rb:395:in `check_host' /Users/benoit/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/uri/generic.rb:409:in `host=' ./features/step_definitions/omniauth_steps.rb:2:in `/^I am signed in with facebook$/' features/omniauth.feature:4:in `Given I am signed in with facebook' Then I open the page # features/step_definitions/debug_steps.rb:5omniauth.feature
Feature: OmniAuth Scenario: Test Given I am signed in with facebook Then I open the pageomniauth_steps.rb
Given /^I am signed in with facebook$/ do visit "/auth/facebook" end支持/ env.rb
OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:facebook] = { 'uid' => '12345', "user_info" => { "email" => "foobar@example.com", "first_name" => "foo", "last_name" => "Bar" } }初始化/ devise.rb
case when Rails.env.production? config.omniauth :facebook, 'XXXX', 'XXXX', {:scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}} when Rails.env.development? config.omniauth :facebook, 'XXXX', 'XXXX' when Rails.env.test? config.omniauth :facebook, 'XXXX', 'XXXX' OmniAuth.config.full_host = 'http://example.com' # issue 257 end路线
devise_scope :user do get '/auth/:provider' => 'users/omniauth_callbacks#passthru' end devise_for :users, :path => "", :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }omniauth.feature
Feature: OmniAuth Scenario: Test Given I am signed in with facebook Then I open the pageomniauth_steps.rb
Given /^I am signed in with facebook$/ do visit "/auth/facebook" endsupport/env.rb
OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:facebook] = { 'uid' => '12345', "user_info" => { "email" => "foobar@example.com", "first_name" => "foo", "last_name" => "Bar" } }initializer/devise.rb
case when Rails.env.production? config.omniauth :facebook, 'XXXX', 'XXXX', {:scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}} when Rails.env.development? config.omniauth :facebook, 'XXXX', 'XXXX' when Rails.env.test? config.omniauth :facebook, 'XXXX', 'XXXX' OmniAuth.config.full_host = 'http://example.com' # issue 257 endroutes
devise_scope :user do get '/auth/:provider' => 'users/omniauth_callbacks#passthru' end devise_for :users, :path => "", :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }As info, I also configured my facebook test_app with the following URL: http://example.com/
I would be pleased to know if someone has a thought/experienced this. Thank you!
最满意答案
尝试添加:
Before do Capybara.default_host = 'example.com' end到您的支持/ env.rb文件,请尝试注释掉:
OmniAuth.config.full_host = 'http://example.com' # issue 257从您的初始化程序/ devise.rb文件。
try to add :
Before do Capybara.default_host = 'example.com' endto your support/env.rb file, try also commenting out :
OmniAuth.config.full_host = 'http://example.com' # issue 257from your initializer/devise.rb file.
发布评论