2014-03-19 4 views
1

을 나는 현재 다음과 같은 오류 받고 있어요 :RSpec에 실패 "누락 된 호스트에 연결하는 ...!"

1) Organization.invite_user should create a new user for a specific orgs initial user 
    Failure/Error: organization.invite_user(second_email) 
    ActionView::Template::Error: 
     Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true 
    # ./app/views/devise/mailer/reset_password_instructions.html.erb:5:in `_app_views_devise_mailer_reset_password_instructions_html_erb___4480543240081585515_70131221479860' 
    # ./app/models/organization.rb:34:in `invite_user' 
    # ./spec/models/organization_spec.rb:24:in `block (3 levels) in <top (required)>' 

누구나 RSpec에 여기에 일이있을 수 있는지 알고 있습니까?

답변

4

, 다음과 같은 구성을 제공한다 : 링크에 대한

config.action_mailer.default_url_options = { host: 'www.example.com' } 

가 ActionMailer에 의해 생성 될 수를

+0

Rails 4.2에서는 작동하지 않는다. – Alex

3

오류는 아주 자명 한 것처럼 보입니다. 실제로 링크를 렌더링하는 방법을 알 수 있도록 더 많은 정보를 우편물 초기화 프로그램에 제공해야합니다.

Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true 

그렇게하지 않으면 링크가 친척이어야하며 이메일의 링크에 대해 이야기 할 때 의미가 없습니다. 당신의 설정/환경/test.rb 파일에

+0

당신은 내게 당신이 할 것입니다 방법의 예를 제공 할 수 있습니다 이? 레일스에 익숙하지 않다. – locoboy

관련 문제