diff options
| author | mo khan <mo@mokhan.ca> | 2014-10-16 20:35:28 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-10-16 20:35:28 -0600 |
| commit | f2eef36abce2148fe044b6dbda85fadf77754019 (patch) | |
| tree | 33f25a21fd7487cafbad6578e057d71668bb1797 /spec | |
| parent | f3e8563c45ee3a11211428acda1b8305e077545b (diff) | |
publish a command to add a favorites to a users collection as a background job.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/controllers/favorites_controller_spec.rb | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/spec/controllers/favorites_controller_spec.rb b/spec/controllers/favorites_controller_spec.rb index 7bac296f..063318fa 100644 --- a/spec/controllers/favorites_controller_spec.rb +++ b/spec/controllers/favorites_controller_spec.rb @@ -13,47 +13,30 @@ describe FavoritesController do before :each do creation.favorites << favorite creation.save! - get :index, :creation_id => creation.id + get :index, creation_id: creation.id end it "should return them all" do - assigns(:favorites).should include favorite + expect(assigns(:favorites)).to include(favorite) end end context "when adding a cake to your favorites" do before :each do - post :create, :creation_id => creation.id + post :create, creation_id: creation.id end it "should add the cake to the logged in users favorites" do - user.reload.favorites.count == 1 + expect(user.reload.favorites.count).to eql(1) end it "should redirect to the cake detail page" do - response.should redirect_to(creation) + expect(response).to redirect_to(creation) end it "should include a friendly flash message" do - flash[:notice].should_not be_nil - end - end - - context "when trying to add your own cake to your favorites" do - before :each do - creation.user = user - creation.save! - post :create, :creation_id => creation.id - end - - it "should not let you" do - flash[:notice].should == "You can't favorite your own stuff" - end - - it "should redirect you to the creation" do - response.should redirect_to(creation) + expect(flash[:notice]).to_not be_nil end end end - end |
