This project is archived and is in readonly mode.

#5832 ✓resolved
Dmytrii Nagirniak

assert_redirected_to and assert_template should not both pass

Reported by Dmytrii Nagirniak | October 17th, 2010 @ 11:59 PM | in 3.1

The integration unit test:

require 'test_helper'

class TransactionImportsTest < ActionController::IntegrationTest
  test "should fail" do
    get '/transaction_imports/new'
    post '/transaction_imports' # rendered template is still "new" here!
    assert_redirected_to(transaction_imports_url)
    assert_template('new')
  end
end

passes, while it is expected to fail because the last response is redirect.

The 'post', 'get' etc should create a new request (only preserving the session info, cookies etc) to ensure the isolation between requests.

Originated from RSpec issue

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages