18c523a119cd2ae11e8e767e804955c81b445bd7
[depot.git] / test / functional / products_controller_test.rb
1 require 'test_helper'
2
3 class ProductsControllerTest < ActionController::TestCase
4 def test_should_get_index
5 get :index
6 assert_response :success
7 assert_not_nil assigns(:products)
8 end
9
10 def test_should_get_new
11 get :new
12 assert_response :success
13 end
14
15 def test_should_create_product
16 assert_difference('Product.count') do
17 post :create, :product => { }
18 end
19
20 assert_redirected_to product_path(assigns(:product))
21 end
22
23 def test_should_show_product
24 get :show, :id => products(:one).id
25 assert_response :success
26 end
27
28 def test_should_get_edit
29 get :edit, :id => products(:one).id
30 assert_response :success
31 end
32
33 def test_should_update_product
34 put :update, :id => products(:one).id, :product => { }
35 assert_redirected_to product_path(assigns(:product))
36 end
37
38 def test_should_destroy_product
39 assert_difference('Product.count', -1) do
40 delete :destroy, :id => products(:one).id
41 end
42
43 assert_redirected_to products_path
44 end
45 end