@@ -66,18 +66,30 class AuthSourcesControllerTest < ActionController::TestCase | |||||
66 | end |
|
66 | end | |
67 |
|
67 | |||
68 | context "post :destroy" do |
|
68 | context "post :destroy" do | |
69 | context "without users" do |
|
|||
70 |
|
|
69 | setup do | |
71 |
|
|
70 | @auth_source = AuthSource.generate!(:name => 'TestEdit') | |
|
71 | end | |||
|
72 | ||||
|
73 | context "without users" do | |||
|
74 | setup do | |||
72 | post :destroy, :id => @auth_source.id |
|
75 | post :destroy, :id => @auth_source.id | |
73 | end |
|
76 | end | |
74 |
|
77 | |||
75 | should_respond_with :redirect |
|
78 | should_respond_with :redirect | |
76 | should_redirect_to("index") {{:action => 'index'}} |
|
79 | should_redirect_to("index") {{:action => 'index'}} | |
77 | should_set_the_flash_to /deletion/i |
|
80 | should_set_the_flash_to /deletion/i | |
|
81 | end | |||
78 |
|
82 | |||
|
83 | context "with users" do | |||
|
84 | setup do | |||
|
85 | User.generate!(:auth_source => @auth_source) | |||
|
86 | post :destroy, :id => @auth_source.id | |||
79 | end |
|
87 | end | |
80 |
|
88 | |||
81 | should "be tested with users" |
|
89 | should_respond_with :redirect | |
|
90 | should "not destroy the AuthSource" do | |||
|
91 | assert AuthSource.find(@auth_source.id) | |||
|
92 | end | |||
|
93 | end | |||
82 | end |
|
94 | end | |
83 | end |
|
95 | end |
General Comments 0
You need to be logged in to leave comments.
Login now