This project is archived and is in readonly mode.

#1913 ✓committed
Pat Nakajima

Use #to_param in generated controller tests.

Reported by Pat Nakajima | February 8th, 2009 @ 04:46 PM | in 2.x

Currently, when you generate a new scaffold, the generated controller tests are calling .id on a fixture like so:


def test_should_get_show
  get :show, :id => articles(:one).id
end

Since to_param is the canonical thing to pass, we should generate tests that conform to this standard:


def test_should_get_show
  get :show, :id => articles(:one).to_param
end

This will lead to fewer broken tests after something as trivial as a slug change.

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>

People watching this ticket

Attachments

Referenced by

Pages