Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Rspec to test for notice after page redirect
    primarykey
    data
    text
    <p>Trying to test for a notice after a page redirect after signed in users try to access the new and create actions.</p> <p>Spec Failures: </p> <p>Failures:</p> <pre><code>1) Authentication authorization as signed in master submitting a GET request to the Masters#new action Failure/Error: it { should have_content("You cannot complete this request when signed in.") } Capybara::ElementNotFound: Unable to find xpath "/html" # ./spec/requests/authentication_pages_spec.rb:126:in `block (5 levels) in &lt;top (required)&gt;' 2) Authentication authorization as signed in master submitting a POST request to the Masters#create action Failure/Error: it { should have_content("You cannot complete this request when signed in.") } Capybara::ElementNotFound: Unable to find xpath "/html" # ./spec/requests/authentication_pages_spec.rb:132:in `block (5 levels) in &lt;top (required)&gt;' </code></pre> <p>Before filter: </p> <pre><code>before_action :already_signed_in, only: [:new, :create] def already_signed_in redirect_to root_url, notice: "You cannot complete this request when signed in." if signed_in? end </code></pre> <p>authorization specs: </p> <pre><code>context "as signed in master" do let(:master) { FactoryGirl.create(:master) } before { sign_in master, no_capybara: true } subject { page } context "submitting a GET request to the Masters#new action" do before { get new_master_path } specify { expect(response).to redirect_to(root_url) } it { should have_content("You cannot complete this request when signed in.") } end context "submitting a POST request to the Masters#create action" do before { post masters_path } specify { expect(response).to redirect_to(root_url) } it { should have_content("You cannot complete this request when signed in.") } end end </code></pre>
    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.
    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