title: rails 5 method not allowed test environment capybara
body: <p>I have the following capybara feature scenario:</p>
  
  <pre><code>scenario 'user can create an account' do
    visit new_user_path
    within(:css, "form[action='/users']") do
      fill_in 'user[username]', with: 'dummy'
      fill_in 'user[email]', with: 'dummy@email.com'
      fill_in 'user[password]', with: 'password'
      fill_in 'user[password_confirmation]', with: 'password'
      fill_in 'user[address]', with: 'brasilia'
      find("input[type='submit']").click
    end
    expect(page).to have_current_path(root_path)
  end
  </code></pre>
  
  <p>When I execute it, I get the following error:</p>
  
  <pre><code>1) CreateAccount user can create an account
   Failure/Error: expect(page).to have_current_path(root_path)
     expected "/users" to equal "/"
   # ./spec/features/create_account_spec.rb:14:in `block (2 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>So I tested in development environment with the same params, and everything is working. I used <code>save_and_open_screenshot</code> inside the scenario and I get this message:</p>
  
  <pre><code>Method not Allowed
  </code></pre>
  
  <p>I don't know what's is happening. Thanks in advance for any help!</p>
  
  <h2>Edit 1</h2>
  
  <p>I inspect the log but I didn't able to see any request being made, but only an error related to database. Here what I found:</p>
  
  <pre><code>SELECT schemaname || '.' || tablename
              FROM pg_tables
              WHERE
                tablename !~ '_prt_' AND
                tablename &lt;&gt; 'schema_migrations' AND
                schemaname = ANY (current_schemas(false))
  </code></pre>
  
  <p>I don't know if this will help but the only log snippet thats looks like an error.</p>
  
  <h2>Edit 2</h2>
  
  <p>I runned <code>rails s -e test</code> and discovered that the hidden_tag authencity token is missing inside the form tag that mades the request. Can this be the cause of <code>method not allowed</code>? </p>