summaryrefslogtreecommitdiff
path: root/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb
blob: fc46f7255380848d74bf690fc9877acc0265990f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
  context "update action" do
    should "render edit template when model is invalid" do
      <%= class_name %>.any_instance.stubs(:valid?).returns(false)
      put :update, :id => <%= class_name %>.first
      assert_template 'edit'
    end

    should "redirect when model is valid" do
      <%= class_name %>.any_instance.stubs(:valid?).returns(true)
      put :update, :id => <%= class_name %>.first
      assert_redirected_to <%= item_path_for_test('url') %>
    end
  end