Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I resolve "Missing host to link to! Please provide the :host parameter"? (RoR)
    primarykey
    data
    text
    <p>I'm following the <a href="http://ruby.railstutorial.org/">RoR Tutorial</a> and I'm stuck at <a href="http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#code-correct_user_before_filter">Listing 9.15</a> </p> <p>I getting the following error after running <strong>'bundle exec rspec spec/'</strong> :</p> <pre><code>1) Authentication authorization as wrong user submitting a PATCH request to the Users#update action Failure/Error: specify { expect(response).to redirect_to(root_url) } ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true # ./spec/features/authentication_pages_spec.rb:79:in `block (5 levels) in &lt;top (required)&gt;' </code></pre> <p>My Authentication test code is: </p> <p>require 'spec_helper'</p> <pre><code>describe "Authentication", type: :request do subject { page } describe "signin page" do before { visit signin_path } it { should have_content('Sign in') } it { should have_title('Sign in') } end describe "signin" do before { visit signin_path } describe "with invalid information" do before { click_button "Sign in" } it { should have_title('Sign in') } it { should have_selector('div.alert.alert-error', text: 'Invalid') } describe "after visiting another page" do before { click_link "Home" } it { should_not have_selector('div.alert.alert-error') } end end describe "with valid information" do let(:user) { FactoryGirl.create(:user) } before { sign_in user } #it { should have_title(user.name) } it { should have_link('Profile', href: user_path(user)) } it { should have_link('Settings', href: edit_user_path(user)) } it { should have_link('Sign out', href: signout_path) } it { should_not have_link('Sign in', href: signin_path) } describe "followed by signout" do before { click_link "Sign out" } it { should have_link('Sign in') } end end end describe "authorization" do describe "for non-signed-in users" do let(:user) { FactoryGirl.create(:user) } describe "in the Users controller" do describe "visiting the edit page" do before { visit edit_user_path(user) } it { should have_title('Sign in') } end describe "submitting to the update action" do before { patch user_path(user) } specify { expect(response).to redirect_to(signin_path) } end end end describe "as wrong user" do let(:user) { FactoryGirl.create(:user) } let(:wrong_user) { FactoryGirl.create(:user, email: "wrong@example.com") } before { sign_in user, no_capybara: true } describe "visiting Users#edit page" do before { visit edit_user_path(wrong_user) } #it { should_not have_title(full_title('Edit user')) } end describe "submitting a PATCH request to the Users#update action" do before { patch user_path(wrong_user) } specify { expect(response).to redirect_to(root_url) } end end end end </code></pre> <p>I don't know how to resolve this issue so the test passes. How <strong><em>do</em></strong> I resolve it? Could someone explain what's going wrong? (According to the tutorial the test should be passing).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload