1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #---
- # Excerpted from "Agile Web Development with Rails",
- # published by The Pragmatic Bookshelf.
- # Copyrights apply to this code. It may not be used to create training material,
- # courses, books, articles, and the like. Contact us if you are in doubt.
- # We make no guarantees that this code is fit for any purpose.
- # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
- #---
- #---
- # Excerpted from "Agile Web Development with Rails, 4rd Ed.",
- # published by The Pragmatic Bookshelf.
- # Copyrights apply to this code. It may not be used to create training material,
- # courses, books, articles, and the like. Contact us if you are in doubt.
- # We make no guarantees that this code is fit for any purpose.
- # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
- #---
- require 'test_helper'
- class OrdersControllerTest < ActionController::TestCase
- setup do
- @order = orders(:one)
- end
- test "should get index" do
- get :index
- assert_response :success
- assert_not_nil assigns(:orders)
- end
- test "should get new" do
- get :new
- assert_response :success
- end
- test "should create order" do
- assert_difference('Order.count') do
- post :create, :order => @order.attributes
- end
- assert_redirected_to order_path(assigns(:order))
- end
- test "should show order" do
- get :show, :id => @order.to_param
- assert_response :success
- end
- test "should get edit" do
- get :edit, :id => @order.to_param
- assert_response :success
- end
- test "should update order" do
- put :update, :id => @order.to_param, :order => @order.attributes
- assert_redirected_to order_path(assigns(:order))
- end
- test "should destroy order" do
- assert_difference('Order.count', -1) do
- delete :destroy, :id => @order.to_param
- end
- assert_redirected_to orders_path
- end
- end
|