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