summaryrefslogtreecommitdiff
path: root/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb')
-rw-r--r--lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb b/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb
new file mode 100644
index 0000000..fc46f72
--- /dev/null
+++ b/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb
@@ -0,0 +1,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