Created
July 30, 2011 17:42
-
-
Save ch1ago/1115777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| protect_from_forgery | |
| helper_method :is_manager?, :current_cart, :cc | |
| protected | |
| def current_cart | |
| @current_cart ||= session[:cart_key] ? Cart.where(w).first : Cart.new | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #how do I setup the @cart variable if the correct call for it is in the ApplicationController? | |
| require 'test_helper' | |
| class CartsControllerTest < ActionController::TestCase | |
| setup do | |
| @cart = carts(:one) | |
| # ??????????? | |
| end | |
| test "should get index" do | |
| get :index | |
| assert_response :success | |
| assert_not_nil assigns(:carts) | |
| end | |
| test "should show cart" do | |
| get :show, :id => :current | |
| assert_response :success | |
| end | |
| test "should update cart" do | |
| put :update, :id => :current, :cart => @cart.attributes | |
| assert_redirected_to cart_path(assigns(:cart)) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment