Commit acb46ba0

mo khan <mo@mokhan.ca>
2013-05-05 02:06:00
fix ignored creation controller spec
1 parent 694e483
Changed files (2)
app/controllers/creations_controller.rb
@@ -1,28 +1,24 @@
 class CreationsController < ApplicationController
   before_filter :authenticate_user!, :except => [:show, :index]
-  # GET /creations
+
   def index
     @creations = FindAllCreationsQuery.new.fetch(params)
   end
 
-  # GET /creations/1
   def show
     @creation = Creation.find(params[:id])
     @primary_photo = @creation.primary_image
   end
 
-  # GET /creations/new
   def new
     @creation = Creation.new
     @user = current_user
   end
 
-  # GET /creations/1/edit
   def edit
     @creation = current_user.creations.find(params[:id])
   end
 
-  # POST /creations
   def create
     @creation = current_user.creations.create(params[:creation])
     @creation.category_ids = params[:creation][:category_ids] ||= []
@@ -37,7 +33,6 @@ class CreationsController < ApplicationController
     end
   end
 
-  # PUT /creations/1
   def update
     @creation = current_user.creations.find(params[:id])
     @creation.category_ids = params[:creation][:category_ids] ||= []
@@ -51,7 +46,6 @@ class CreationsController < ApplicationController
     end
   end
 
-  # DELETE /creations/1
   def destroy
     current_user.creations.find(params[:id]).destroy
     redirect_to(creations_url) 
spec/controllers/creations_controller_spec.rb
@@ -24,9 +24,7 @@ describe CreationsController do
   end
 
   context "when logged in" do
-    before(:each) do
-      http_login(user)
-    end
+    before { http_login(user) }
 
     describe "GET show" do
       it "assigns the requested creation as @creation" do
@@ -59,11 +57,13 @@ describe CreationsController do
           creations.stub(:create).and_return(creation)
           post :create, :creation => {:id => creation.id, :name => 'new name'}
         end
+
         it "assigns a newly created creation as @creation" do
           assigns(:creation).should eq(creation)
         end
-        pending "redirects to the created creation" do
-          response.should redirect_to(creations_url)
+
+        it "redirects to the created creation" do
+          response.should redirect_to(new_creation_photo_path(creation))
         end
       end