summaryrefslogtreecommitdiff
path: root/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb')
-rw-r--r--lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb b/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb
new file mode 100644
index 0000000..f305367
--- /dev/null
+++ b/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb
@@ -0,0 +1,13 @@
+ context "create action" do
+ should "render new template when model is invalid" do
+ <%= class_name %>.any_instance.stubs(:valid?).returns(false)
+ post :create
+ assert_template 'new'
+ end
+
+ should "redirect when model is valid" do
+ <%= class_name %>.any_instance.stubs(:valid?).returns(true)
+ post :create
+ assert_redirected_to <%= item_path_for_test('url') %>
+ end
+ end