Commit 47a7f8c8

mo k <mo@mokhan.ca>
2012-09-25 12:45:54
add spec to ensure errors are present with an invalid creation.
1 parent f28fdfc
Changed files (1)
spec/controllers/creations_controller_spec.rb
@@ -58,20 +58,15 @@ describe CreationsController do
     end
 
     describe "with invalid params" do
-      def mock_creation(stubs={})
-        @mock_creation ||= mock_model(Creation, stubs).as_null_object
-      end
-      it "assigns a newly created but unsaved creation as @creation" do
-        user.stub(:creations){ mock_creation(:save => false) }
-        post :create, :creation => {'these' => 'params'}
-        assigns(:creation).should be(mock_creation)
+      before :each do
+        post :create, :creation => {:name => ''}
       end
-
       it "re-renders the 'new' template" do
-        user.stub(:creations){ mock_creation(:save => false) }
-        post :create, :creation => {}
         response.should render_template("new")
       end
+      it "should include the errors" do
+        assigns(:creation).errors.any?.should be_true
+      end
     end
   end