Mercurial > hg > soundsoftware-site
comparison test/functional/.svn/text-base/auth_sources_controller_test.rb.svn-base @ 0:513646585e45
* Import Redmine trunk SVN rev 3859
author | Chris Cannam |
---|---|
date | Fri, 23 Jul 2010 15:52:44 +0100 |
parents | |
children | 1d32c0a0efbf |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:513646585e45 |
---|---|
1 require 'test_helper' | |
2 | |
3 class AuthSourcesControllerTest < ActionController::TestCase | |
4 fixtures :all | |
5 | |
6 def setup | |
7 @request.session[:user_id] = 1 | |
8 end | |
9 | |
10 context "get :index" do | |
11 setup do | |
12 get :index | |
13 end | |
14 | |
15 should_assign_to :auth_sources | |
16 should_assign_to :auth_source_pages | |
17 should_respond_with :success | |
18 should_render_template :index | |
19 end | |
20 | |
21 context "get :new" do | |
22 setup do | |
23 get :new | |
24 end | |
25 | |
26 should_assign_to :auth_source | |
27 should_respond_with :success | |
28 should_render_template :new | |
29 | |
30 should "initilize a new AuthSource" do | |
31 assert_equal AuthSource, assigns(:auth_source).class | |
32 assert assigns(:auth_source).new_record? | |
33 end | |
34 end | |
35 | |
36 context "post :create" do | |
37 setup do | |
38 post :create, :auth_source => {:name => 'Test'} | |
39 end | |
40 | |
41 should_respond_with :redirect | |
42 should_redirect_to("index") {{:action => 'index'}} | |
43 should_set_the_flash_to /success/i | |
44 end | |
45 | |
46 context "get :edit" do | |
47 setup do | |
48 @auth_source = AuthSource.generate!(:name => 'TestEdit') | |
49 get :edit, :id => @auth_source.id | |
50 end | |
51 | |
52 should_assign_to(:auth_source) {@auth_source} | |
53 should_respond_with :success | |
54 should_render_template :edit | |
55 end | |
56 | |
57 context "post :update" do | |
58 setup do | |
59 @auth_source = AuthSource.generate!(:name => 'TestEdit') | |
60 post :update, :id => @auth_source.id, :auth_source => {:name => 'TestUpdate'} | |
61 end | |
62 | |
63 should_respond_with :redirect | |
64 should_redirect_to("index") {{:action => 'index'}} | |
65 should_set_the_flash_to /update/i | |
66 end | |
67 | |
68 context "post :destroy" do | |
69 context "without users" do | |
70 setup do | |
71 @auth_source = AuthSource.generate!(:name => 'TestEdit') | |
72 post :destroy, :id => @auth_source.id | |
73 end | |
74 | |
75 should_respond_with :redirect | |
76 should_redirect_to("index") {{:action => 'index'}} | |
77 should_set_the_flash_to /deletion/i | |
78 | |
79 end | |
80 | |
81 should "be tested with users" | |
82 end | |
83 end |