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

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