##// END OF EJS Templates
remove fixtures from test/functional/auth_sources_controller_test.rb...
Toshi MARUYAMA -
r7367:6f6c519d0c9c
parent child
Show More
@@ -1,95 +1,94
1 1 require File.expand_path('../../test_helper', __FILE__)
2 2
3 3 class AuthSourcesControllerTest < ActionController::TestCase
4 fixtures :all
5 4
6 5 def setup
7 6 @request.session[:user_id] = 1
8 7 end
9 8
10 9 context "get :index" do
11 10 setup do
12 11 get :index
13 12 end
14 13
15 14 should_assign_to :auth_sources
16 15 should_assign_to :auth_source_pages
17 16 should_respond_with :success
18 17 should_render_template :index
19 18 end
20 19
21 20 context "get :new" do
22 21 setup do
23 22 get :new
24 23 end
25 24
26 25 should_assign_to :auth_source
27 26 should_respond_with :success
28 27 should_render_template :new
29 28
30 29 should "initilize a new AuthSource" do
31 30 assert_equal AuthSource, assigns(:auth_source).class
32 31 assert assigns(:auth_source).new_record?
33 32 end
34 33 end
35 34
36 35 context "post :create" do
37 36 setup do
38 37 post :create, :auth_source => {:name => 'Test'}
39 38 end
40 39
41 40 should_respond_with :redirect
42 41 should_redirect_to("index") {{:action => 'index'}}
43 42 should_set_the_flash_to /success/i
44 43 end
45 44
46 45 context "get :edit" do
47 46 setup do
48 47 @auth_source = AuthSource.generate!(:name => 'TestEdit')
49 48 get :edit, :id => @auth_source.id
50 49 end
51 50
52 51 should_assign_to(:auth_source) {@auth_source}
53 52 should_respond_with :success
54 53 should_render_template :edit
55 54 end
56 55
57 56 context "post :update" do
58 57 setup do
59 58 @auth_source = AuthSource.generate!(:name => 'TestEdit')
60 59 post :update, :id => @auth_source.id, :auth_source => {:name => 'TestUpdate'}
61 60 end
62 61
63 62 should_respond_with :redirect
64 63 should_redirect_to("index") {{:action => 'index'}}
65 64 should_set_the_flash_to /update/i
66 65 end
67 66
68 67 context "post :destroy" do
69 68 setup do
70 69 @auth_source = AuthSource.generate!(:name => 'TestEdit')
71 70 end
72 71
73 72 context "without users" do
74 73 setup do
75 74 post :destroy, :id => @auth_source.id
76 75 end
77 76
78 77 should_respond_with :redirect
79 78 should_redirect_to("index") {{:action => 'index'}}
80 79 should_set_the_flash_to /deletion/i
81 80 end
82 81
83 82 context "with users" do
84 83 setup do
85 84 User.generate!(:auth_source => @auth_source)
86 85 post :destroy, :id => @auth_source.id
87 86 end
88 87
89 88 should_respond_with :redirect
90 89 should "not destroy the AuthSource" do
91 90 assert AuthSource.find(@auth_source.id)
92 91 end
93 92 end
94 93 end
95 94 end
General Comments 0
You need to be logged in to leave comments. Login now