branston 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/branston/Gemfile +25 -0
- data/lib/branston/Gemfile.lock +76 -0
- data/lib/branston/app/controllers/application_controller.rb +1 -1
- data/lib/branston/app/controllers/outcomes_controller.rb +2 -0
- data/lib/branston/app/controllers/stories_controller.rb +82 -86
- data/lib/branston/app/controllers/users_controller.rb +69 -11
- data/lib/branston/app/helpers/iterations_helper.rb +13 -13
- data/lib/branston/app/models/iteration.rb +3 -1
- data/lib/branston/app/models/release.rb +0 -1
- data/lib/branston/app/models/story.rb +30 -28
- data/lib/branston/app/models/user.rb +46 -1
- data/lib/branston/app/views/layouts/_header.html.erb +8 -3
- data/lib/branston/app/views/layouts/user_roles.html.erb +5 -5
- data/lib/branston/app/views/sessions/new.html.erb +8 -14
- data/lib/branston/app/views/users/_admin_controls.html.erb +14 -0
- data/lib/branston/app/views/users/_form.html.erb +27 -0
- data/lib/branston/app/views/users/edit.html.erb +9 -0
- data/lib/branston/app/views/users/index.html.erb +14 -0
- data/lib/branston/app/views/users/new.html.erb +3 -22
- data/lib/branston/config/boot.rb +20 -0
- data/lib/branston/config/environment.rb +2 -7
- data/lib/branston/config/environments/test.rb +0 -8
- data/lib/branston/config/preinitializer.rb +21 -0
- data/lib/branston/config/routes.rb +15 -10
- data/lib/branston/db/development.sqlite3 +0 -0
- data/lib/branston/db/development_structure.sql +21 -8
- data/lib/branston/db/migrate/20100723161424_add_state_to_user.rb +12 -0
- data/lib/branston/db/migrate/20100726150322_add_activation_fields_to_user.rb +12 -0
- data/lib/branston/db/migrate/20100729125551_set_default_user_state_to_pending.rb +10 -0
- data/lib/branston/db/migrate/20100812133837_add_is_admin_property_to_user.rb +10 -0
- data/lib/branston/db/migrate/20100812140532_set_default_user_state_to_active.rb +10 -0
- data/lib/branston/db/migrate/20100812143455_add_default_admin_user.rb +17 -0
- data/lib/branston/db/migrate/20110408162438_remove_is_admin_property_and_add_role_instead.rb +12 -0
- data/lib/branston/db/pristine.sqlite3 +0 -0
- data/lib/branston/db/schema.rb +6 -8
- data/lib/branston/db/test.sqlite3 +0 -0
- data/lib/branston/log/development.log +1181 -433
- data/lib/branston/log/test.log +145306 -52026
- data/lib/branston/test/blueprints.rb +22 -28
- data/lib/branston/test/functional/iterations_controller_test.rb +149 -113
- data/lib/branston/test/functional/outcomes_controller_test.rb +94 -60
- data/lib/branston/test/functional/preconditions_controller_test.rb +101 -67
- data/lib/branston/test/functional/releases_controller_test.rb +85 -49
- data/lib/branston/test/functional/scenarios_controller_test.rb +104 -70
- data/lib/branston/test/functional/stories_controller_test.rb +41 -12
- data/lib/branston/test/functional/users_controller_test.rb +364 -43
- data/lib/branston/test/unit/iteration_test.rb +37 -6
- data/lib/branston/test/unit/outcome_test.rb +2 -2
- data/lib/branston/test/unit/participation_test.rb +2 -2
- data/lib/branston/test/unit/precondition_test.rb +3 -3
- data/lib/branston/test/unit/release_test.rb +4 -0
- data/lib/branston/test/unit/scenario_test.rb +4 -4
- data/lib/branston/test/unit/story_test.rb +62 -40
- data/lib/branston/test/unit/user_test.rb +195 -5
- metadata +136 -156
- data/lib/branston/app/controllers/user_roles_controller.rb +0 -105
- data/lib/branston/app/helpers/user_roles_helper.rb +0 -2
- data/lib/branston/app/models/user_role.rb +0 -21
- data/lib/branston/app/views/layouts/outcomes.html.erb +0 -17
- data/lib/branston/app/views/layouts/preconditions.html.erb +0 -17
- data/lib/branston/app/views/layouts/releases.html.erb +0 -17
- data/lib/branston/app/views/user_roles/edit.html.erb +0 -16
- data/lib/branston/app/views/user_roles/index.html.erb +0 -20
- data/lib/branston/app/views/user_roles/new.html.erb +0 -15
- data/lib/branston/app/views/user_roles/show.html.erb +0 -8
- data/lib/branston/coverage/app-controllers-application_controller_rb.html +0 -231
- data/lib/branston/coverage/app-controllers-iterations_controller_rb.html +0 -801
- data/lib/branston/coverage/app-controllers-outcomes_controller_rb.html +0 -759
- data/lib/branston/coverage/app-controllers-preconditions_controller_rb.html +0 -783
- data/lib/branston/coverage/app-controllers-releases_controller_rb.html +0 -705
- data/lib/branston/coverage/app-controllers-scenarios_controller_rb.html +0 -777
- data/lib/branston/coverage/app-controllers-sessions_controller_rb.html +0 -411
- data/lib/branston/coverage/app-controllers-stories_controller_rb.html +0 -1071
- data/lib/branston/coverage/app-controllers-user_roles_controller_rb.html +0 -693
- data/lib/branston/coverage/app-controllers-users_controller_rb.html +0 -315
- data/lib/branston/coverage/app-helpers-application_helper_rb.html +0 -327
- data/lib/branston/coverage/app-helpers-iterations_helper_rb.html +0 -363
- data/lib/branston/coverage/app-helpers-outcomes_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-preconditions_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-releases_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-sessions_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-stories_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-user_roles_helper_rb.html +0 -75
- data/lib/branston/coverage/app-models-iteration_rb.html +0 -321
- data/lib/branston/coverage/app-models-outcome_rb.html +0 -243
- data/lib/branston/coverage/app-models-participation_rb.html +0 -189
- data/lib/branston/coverage/app-models-precondition_rb.html +0 -243
- data/lib/branston/coverage/app-models-release_rb.html +0 -195
- data/lib/branston/coverage/app-models-scenario_rb.html +0 -231
- data/lib/branston/coverage/app-models-story_rb.html +0 -621
- data/lib/branston/coverage/app-models-user_rb.html +0 -513
- data/lib/branston/coverage/app-models-user_role_rb.html +0 -189
- data/lib/branston/coverage/index.html +0 -570
- data/lib/branston/coverage/jquery-1.3.2.min.js +0 -19
- data/lib/branston/coverage/jquery.tablesorter.min.js +0 -15
- data/lib/branston/coverage/lib-client_rb.html +0 -537
- data/lib/branston/coverage/lib-faker_extras_rb.html +0 -207
- data/lib/branston/coverage/lib-story_generator_rb.html +0 -873
- data/lib/branston/coverage/print.css +0 -12
- data/lib/branston/coverage/rcov.js +0 -42
- data/lib/branston/coverage/screen.css +0 -270
- data/lib/branston/db/migrate/20091127131037_create_user_roles.rb +0 -13
- data/lib/branston/db/migrate/20091127172950_add_story_id_to_user_role.rb +0 -10
- data/lib/branston/test/functional/user_roles_controller_test.rb +0 -71
- data/lib/branston/test/unit/helpers/user_roles_helper_test.rb +0 -4
- data/lib/branston/test/unit/user_role_test.rb +0 -9
- data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_flat.txt +0 -8
- data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_graph.html +0 -6718
- data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_tree.txt +0 -9942
- data/lib/branston/vendor/plugins/state_machine/CHANGELOG.rdoc +0 -298
- data/lib/branston/vendor/plugins/state_machine/LICENSE +0 -20
- data/lib/branston/vendor/plugins/state_machine/README.rdoc +0 -466
- data/lib/branston/vendor/plugins/state_machine/Rakefile +0 -98
- data/lib/branston/vendor/plugins/state_machine/examples/AutoShop_state.png +0 -0
- data/lib/branston/vendor/plugins/state_machine/examples/Car_state.png +0 -0
- data/lib/branston/vendor/plugins/state_machine/examples/TrafficLight_state.png +0 -0
- data/lib/branston/vendor/plugins/state_machine/examples/Vehicle_state.png +0 -0
- data/lib/branston/vendor/plugins/state_machine/examples/auto_shop.rb +0 -11
- data/lib/branston/vendor/plugins/state_machine/examples/car.rb +0 -19
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/controller.rb +0 -51
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb +0 -28
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_edit.html.erb +0 -24
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_index.html.erb +0 -23
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_new.html.erb +0 -13
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_show.html.erb +0 -17
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/controller.rb +0 -43
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/migration.rb +0 -11
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/model.rb +0 -23
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_edit.html.erb +0 -25
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_index.html.erb +0 -23
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_new.html.erb +0 -14
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_show.html.erb +0 -17
- data/lib/branston/vendor/plugins/state_machine/examples/traffic_light.rb +0 -7
- data/lib/branston/vendor/plugins/state_machine/examples/vehicle.rb +0 -31
- data/lib/branston/vendor/plugins/state_machine/init.rb +0 -1
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine.rb +0 -388
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/assertions.rb +0 -36
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/callback.rb +0 -189
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/condition_proxy.rb +0 -94
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/eval_helpers.rb +0 -67
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/event.rb +0 -252
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/event_collection.rb +0 -122
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/extensions.rb +0 -149
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/guard.rb +0 -230
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations.rb +0 -68
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record.rb +0 -492
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record/locale.rb +0 -11
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record/observer.rb +0 -41
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/data_mapper.rb +0 -351
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/data_mapper/observer.rb +0 -139
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/sequel.rb +0 -322
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/machine.rb +0 -1467
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/machine_collection.rb +0 -155
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/matcher.rb +0 -123
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/matcher_helpers.rb +0 -54
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/node_collection.rb +0 -152
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/state.rb +0 -249
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/state_collection.rb +0 -112
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/transition.rb +0 -394
- data/lib/branston/vendor/plugins/state_machine/state_machine.gemspec +0 -30
- data/lib/branston/vendor/plugins/state_machine/tasks/state_machine.rake +0 -1
- data/lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb +0 -30
- data/lib/branston/vendor/plugins/state_machine/test/classes/switch.rb +0 -11
- data/lib/branston/vendor/plugins/state_machine/test/functional/state_machine_test.rb +0 -941
- data/lib/branston/vendor/plugins/state_machine/test/test_helper.rb +0 -4
- data/lib/branston/vendor/plugins/state_machine/test/unit/assertions_test.rb +0 -40
- data/lib/branston/vendor/plugins/state_machine/test/unit/callback_test.rb +0 -455
- data/lib/branston/vendor/plugins/state_machine/test/unit/condition_proxy_test.rb +0 -328
- data/lib/branston/vendor/plugins/state_machine/test/unit/eval_helpers_test.rb +0 -120
- data/lib/branston/vendor/plugins/state_machine/test/unit/event_collection_test.rb +0 -326
- data/lib/branston/vendor/plugins/state_machine/test/unit/event_test.rb +0 -743
- data/lib/branston/vendor/plugins/state_machine/test/unit/guard_test.rb +0 -908
- data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/active_record_test.rb +0 -1367
- data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/data_mapper_test.rb +0 -962
- data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/sequel_test.rb +0 -859
- data/lib/branston/vendor/plugins/state_machine/test/unit/integrations_test.rb +0 -42
- data/lib/branston/vendor/plugins/state_machine/test/unit/invalid_event_test.rb +0 -7
- data/lib/branston/vendor/plugins/state_machine/test/unit/invalid_transition_test.rb +0 -7
- data/lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb +0 -938
- data/lib/branston/vendor/plugins/state_machine/test/unit/machine_test.rb +0 -2004
- data/lib/branston/vendor/plugins/state_machine/test/unit/matcher_helpers_test.rb +0 -37
- data/lib/branston/vendor/plugins/state_machine/test/unit/matcher_test.rb +0 -155
- data/lib/branston/vendor/plugins/state_machine/test/unit/node_collection_test.rb +0 -207
- data/lib/branston/vendor/plugins/state_machine/test/unit/state_collection_test.rb +0 -280
- data/lib/branston/vendor/plugins/state_machine/test/unit/state_machine_test.rb +0 -31
- data/lib/branston/vendor/plugins/state_machine/test/unit/state_test.rb +0 -795
- data/lib/branston/vendor/plugins/state_machine/test/unit/transition_test.rb +0 -1212
@@ -3,103 +3,137 @@ require 'test_helper'
|
|
3
3
|
class PreconditionsControllerTest < ActionController::TestCase
|
4
4
|
|
5
5
|
context "The PreconditionsController" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
should "get index" do
|
13
|
-
get :index, :scenario_id => @scenario.id
|
14
|
-
assert_response :success
|
15
|
-
assert_not_nil assigns(:preconditions)
|
16
|
-
end
|
17
|
-
|
18
|
-
should "get new" do
|
19
|
-
get :new, :scenario_id => @scenario.id
|
20
|
-
assert_response :success
|
21
|
-
end
|
6
|
+
context "when the user is not logged in" do
|
7
|
+
[:index, :new, :edit].each do |action|
|
8
|
+
context "on GET to #{action.to_s}" do
|
9
|
+
setup do
|
10
|
+
get action
|
11
|
+
end
|
22
12
|
|
23
|
-
|
24
|
-
|
25
|
-
setup do
|
26
|
-
assert_difference('Precondition.count') do
|
27
|
-
post :create, :precondition => { :description => "Foo" }, :scenario_id => @scenario.id
|
13
|
+
should "redirect to login" do
|
14
|
+
assert_redirected_to new_session_path
|
28
15
|
end
|
29
16
|
end
|
17
|
+
end
|
30
18
|
|
31
|
-
|
32
|
-
|
19
|
+
context "on PUT to :update" do
|
20
|
+
setup do
|
21
|
+
put :update
|
22
|
+
end
|
23
|
+
should "redirect to login" do
|
24
|
+
assert_redirected_to new_session_path
|
33
25
|
end
|
34
|
-
|
35
26
|
end
|
36
27
|
|
37
|
-
context "
|
28
|
+
context "on POST to :create" do
|
38
29
|
setup do
|
39
|
-
|
40
|
-
post :create, :precondition => { }, :scenario_id => @scenario.id
|
41
|
-
end
|
30
|
+
post :create
|
42
31
|
end
|
43
|
-
|
44
|
-
|
45
|
-
assert_response :success
|
32
|
+
should "redirect to login" do
|
33
|
+
assert_redirected_to new_session_path
|
46
34
|
end
|
35
|
+
end
|
36
|
+
end
|
47
37
|
|
48
|
-
|
49
|
-
|
50
|
-
|
38
|
+
context "when the user is logged in" do
|
39
|
+
setup do
|
40
|
+
login_as(User.make)
|
41
|
+
@scenario = Scenario.make
|
42
|
+
@precondition = Precondition.make
|
43
|
+
end
|
51
44
|
|
45
|
+
should "get index" do
|
46
|
+
get :index, :scenario_id => @scenario.id
|
47
|
+
assert_response :success
|
48
|
+
assert_not_nil assigns(:preconditions)
|
49
|
+
end
|
50
|
+
|
51
|
+
should "get new" do
|
52
|
+
get :new, :scenario_id => @scenario.id
|
53
|
+
assert_response :success
|
52
54
|
end
|
53
|
-
end
|
54
55
|
|
56
|
+
context "creating a precondition" do
|
57
|
+
context "with valid params" do
|
58
|
+
setup do
|
59
|
+
assert_difference('Precondition.count') do
|
60
|
+
post :create, :precondition => { :description => "Foo" }, :scenario_id => @scenario.id
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
should "redirect to show" do
|
65
|
+
assert_redirected_to precondition_path(assigns(:precondition))
|
66
|
+
end
|
55
67
|
|
56
|
-
context "updating a precondition" do
|
57
|
-
context "with valid params" do
|
58
|
-
setup do
|
59
|
-
put :update, :id => @precondition.to_param, :precondition => { :description => "Bar" }, :scenario_id => @scenario.id
|
60
68
|
end
|
61
|
-
|
62
|
-
|
69
|
+
|
70
|
+
context "with invalid params" do
|
71
|
+
setup do
|
72
|
+
assert_no_difference('Precondition.count') do
|
73
|
+
post :create, :precondition => { }, :scenario_id => @scenario.id
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
should "redisplay" do
|
78
|
+
assert_response :success
|
79
|
+
end
|
80
|
+
|
81
|
+
should "use new template" do
|
82
|
+
assert_template 'new'
|
83
|
+
end
|
84
|
+
|
63
85
|
end
|
64
86
|
end
|
65
87
|
|
66
|
-
context "with invalid params" do
|
67
|
-
setup do
|
68
|
-
put :update, :id => @precondition.to_param, :precondition => { :description => "" }, :scenario_id => @scenario.id
|
69
|
-
end
|
70
88
|
|
71
|
-
|
72
|
-
|
89
|
+
context "updating a precondition" do
|
90
|
+
context "with valid params" do
|
91
|
+
setup do
|
92
|
+
put :update, :id => @precondition.to_param, :precondition => { :description => "Bar" }, :scenario_id => @scenario.id
|
93
|
+
end
|
94
|
+
should "redirect to show" do
|
95
|
+
assert_redirected_to precondition_path(assigns(:precondition))
|
96
|
+
end
|
73
97
|
end
|
74
98
|
|
75
|
-
|
76
|
-
|
99
|
+
context "with invalid params" do
|
100
|
+
setup do
|
101
|
+
put :update, :id => @precondition.to_param, :precondition => { :description => "" }, :scenario_id => @scenario.id
|
102
|
+
end
|
103
|
+
|
104
|
+
should "redisplay" do
|
105
|
+
assert_response :success
|
106
|
+
end
|
107
|
+
|
108
|
+
should "use edit template" do
|
109
|
+
assert_template :edit
|
110
|
+
end
|
77
111
|
end
|
78
112
|
end
|
79
|
-
end
|
80
113
|
|
81
114
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
should "get edit" do
|
88
|
-
get :edit, :id => @precondition.to_param, :scenario_id => @scenario.id
|
89
|
-
assert_response :success
|
90
|
-
end
|
115
|
+
should "show precondition" do
|
116
|
+
get :show, :id => @precondition.to_param, :scenario_id => @scenario.id
|
117
|
+
assert_response :success
|
118
|
+
end
|
91
119
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
120
|
+
should "get edit" do
|
121
|
+
get :edit, :id => @precondition.to_param, :scenario_id => @scenario.id
|
122
|
+
assert_response :success
|
123
|
+
end
|
96
124
|
|
97
|
-
|
98
|
-
|
99
|
-
|
125
|
+
should "update precondition" do
|
126
|
+
put :update, :id => @precondition.to_param, :precondition => { }, :scenario_id => @scenario.id
|
127
|
+
assert_redirected_to precondition_path(assigns(:precondition))
|
100
128
|
end
|
101
129
|
|
102
|
-
|
130
|
+
should "destroy precondition" do
|
131
|
+
assert_difference('Precondition.count', -1) do
|
132
|
+
delete :destroy, :id => @precondition.to_param
|
133
|
+
end
|
134
|
+
|
135
|
+
assert_redirected_to preconditions_path
|
136
|
+
end
|
103
137
|
end
|
104
138
|
end
|
105
139
|
end
|
@@ -2,67 +2,103 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class ReleasesControllerTest < ActionController::TestCase
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
context "The ReleasesController" do
|
6
|
+
context "when the user is not logged in" do
|
7
|
+
[:index, :new, :edit].each do |action|
|
8
|
+
context "on GET to #{action.to_s}" do
|
9
|
+
setup do
|
10
|
+
get action
|
11
|
+
end
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
should "redirect to login" do
|
14
|
+
assert_redirected_to new_session_path
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
19
|
+
context "on PUT to :update" do
|
20
|
+
setup do
|
21
|
+
put :update
|
22
|
+
end
|
23
|
+
should "redirect to login" do
|
24
|
+
assert_redirected_to new_session_path
|
25
|
+
end
|
26
|
+
end
|
20
27
|
|
21
|
-
|
22
|
-
|
23
|
-
|
28
|
+
context "on POST to :create" do
|
29
|
+
setup do
|
30
|
+
post :create
|
31
|
+
end
|
32
|
+
should "redirect to login" do
|
33
|
+
assert_redirected_to new_session_path
|
34
|
+
end
|
35
|
+
end
|
24
36
|
end
|
25
37
|
|
26
|
-
|
27
|
-
|
38
|
+
context "when the user is logged in" do
|
39
|
+
setup do
|
40
|
+
login_as(User.make)
|
41
|
+
@release = Release.make
|
42
|
+
end
|
28
43
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
44
|
+
should "should get index" do
|
45
|
+
get :index
|
46
|
+
assert_response :success
|
47
|
+
assert_not_nil assigns(:releases)
|
48
|
+
end
|
35
49
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
50
|
+
should "should get new" do
|
51
|
+
get :new
|
52
|
+
assert_response :success
|
53
|
+
end
|
40
54
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
55
|
+
should "should create release" do
|
56
|
+
assert_difference('Release.count') do
|
57
|
+
post :create, :release => Release.plan
|
58
|
+
end
|
45
59
|
|
46
|
-
|
47
|
-
|
48
|
-
put :update, :id => @release.to_param, :release => Release.plan
|
49
|
-
assert_redirected_to release_path(assigns(:release))
|
50
|
-
end
|
51
|
-
end
|
60
|
+
assert_redirected_to release_path(assigns(:release))
|
61
|
+
end
|
52
62
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
63
|
+
should "should display validation errors with invalid data" do
|
64
|
+
assert_no_difference('Release.count') do
|
65
|
+
post :create, :release => { :release_date => "30/30/2009", :notes => 'hi' }
|
66
|
+
assert_template :new
|
67
|
+
end
|
68
|
+
end
|
59
69
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
70
|
+
should "should show release" do
|
71
|
+
get :show, :id => @release.to_param
|
72
|
+
assert_response :success
|
73
|
+
end
|
74
|
+
|
75
|
+
should "should get edit" do
|
76
|
+
get :edit, :id => @release.to_param
|
77
|
+
assert_response :success
|
78
|
+
end
|
64
79
|
|
65
|
-
|
80
|
+
should "should update release" do
|
81
|
+
assert_no_difference('Release.count') do
|
82
|
+
put :update, :id => @release.to_param, :release => Release.plan
|
83
|
+
assert_redirected_to release_path(assigns(:release))
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
should "should display validation errors with invalid data on update" do
|
88
|
+
assert_no_difference('Release.count') do
|
89
|
+
put :update, :id => @release.to_param, :release => { :release_date => "30/30/2009", :notes => 'hi' }
|
90
|
+
assert_template :edit
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
should "should destroy release" do
|
95
|
+
assert_difference('Release.count', -1) do
|
96
|
+
delete :destroy, :id => @release.to_param
|
97
|
+
end
|
98
|
+
|
99
|
+
assert_redirected_to releases_path
|
100
|
+
end
|
101
|
+
end
|
66
102
|
end
|
67
103
|
end
|
68
104
|
|
@@ -3,104 +3,138 @@ require 'test_helper'
|
|
3
3
|
class ScenariosControllerTest < ActionController::TestCase
|
4
4
|
|
5
5
|
context "The ScenariosController" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
should "get index" do
|
14
|
-
get :index, :story_id => @story.to_param, :iteration_id => @iteration.to_param
|
15
|
-
assert_response :success
|
16
|
-
assert_not_nil assigns(:scenarios)
|
17
|
-
end
|
18
|
-
|
19
|
-
should "get new" do
|
20
|
-
get :new, :story_id => @story.to_param, :iteration_id => @iteration.to_param
|
21
|
-
assert_response :success
|
22
|
-
end
|
6
|
+
context "when the user is not logged in" do
|
7
|
+
[:index, :new, :edit].each do |action|
|
8
|
+
context "on GET to #{action.to_s}" do
|
9
|
+
setup do
|
10
|
+
get action
|
11
|
+
end
|
23
12
|
|
24
|
-
|
25
|
-
|
26
|
-
setup do
|
27
|
-
assert_difference('Scenario.count') do
|
28
|
-
post :create, :scenario => { :title => "Foo" }, :story_id => @story.to_param,
|
29
|
-
:iteration_id => @iteration.to_param
|
13
|
+
should "redirect to login" do
|
14
|
+
assert_redirected_to new_session_path
|
30
15
|
end
|
31
16
|
end
|
17
|
+
end
|
32
18
|
|
33
|
-
|
34
|
-
|
19
|
+
context "on PUT to :update" do
|
20
|
+
setup do
|
21
|
+
put :update
|
22
|
+
end
|
23
|
+
should "redirect to login" do
|
24
|
+
assert_redirected_to new_session_path
|
35
25
|
end
|
36
|
-
|
37
26
|
end
|
38
27
|
|
39
|
-
context "
|
28
|
+
context "on POST to :create" do
|
40
29
|
setup do
|
41
|
-
|
42
|
-
post :create, :scenario => { }, :story_id => @story.to_param,
|
43
|
-
:iteration_id => @iteration.to_param
|
44
|
-
end
|
30
|
+
post :create
|
45
31
|
end
|
46
|
-
|
47
|
-
|
48
|
-
assert_response :success
|
32
|
+
should "redirect to login" do
|
33
|
+
assert_redirected_to new_session_path
|
49
34
|
end
|
35
|
+
end
|
36
|
+
end
|
50
37
|
|
51
|
-
|
52
|
-
|
53
|
-
|
38
|
+
context "when the user is logged in" do
|
39
|
+
setup do
|
40
|
+
login_as(User.make)
|
41
|
+
@story = Factory.make_story
|
42
|
+
@iteration = @story.iteration
|
43
|
+
@scenario = @story.scenarios.first
|
44
|
+
end
|
54
45
|
|
46
|
+
should "get index" do
|
47
|
+
get :index, :story_id => @story.to_param, :iteration_id => @iteration.to_param
|
48
|
+
assert_response :success
|
49
|
+
assert_not_nil assigns(:scenarios)
|
55
50
|
end
|
56
|
-
end
|
57
51
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
52
|
+
should "get new" do
|
53
|
+
get :new, :story_id => @story.to_param, :iteration_id => @iteration.to_param
|
54
|
+
assert_response :success
|
55
|
+
end
|
56
|
+
|
57
|
+
context "creating a scenario" do
|
58
|
+
context "with valid params" do
|
59
|
+
setup do
|
60
|
+
assert_difference('Scenario.count') do
|
61
|
+
post :create, :scenario => { :title => "Foo" }, :story_id => @story.to_param,
|
62
|
+
:iteration_id => @iteration.to_param
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
should "redirect to show" do
|
67
|
+
assert_redirected_to iteration_story_scenario_path(@iteration, assigns(:story), assigns(:scenario))
|
68
|
+
end
|
69
|
+
|
63
70
|
end
|
64
|
-
|
65
|
-
|
71
|
+
|
72
|
+
context "with invalid params" do
|
73
|
+
setup do
|
74
|
+
assert_no_difference('Scenario.count') do
|
75
|
+
post :create, :scenario => { }, :story_id => @story.to_param,
|
76
|
+
:iteration_id => @iteration.to_param
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
should "redisplay" do
|
81
|
+
assert_response :success
|
82
|
+
end
|
83
|
+
|
84
|
+
should "use new template" do
|
85
|
+
assert_template 'new'
|
86
|
+
end
|
87
|
+
|
66
88
|
end
|
67
89
|
end
|
68
90
|
|
69
|
-
context "
|
70
|
-
|
71
|
-
|
72
|
-
|
91
|
+
context "updating a scenario" do
|
92
|
+
context "with valid params" do
|
93
|
+
setup do
|
94
|
+
put :update, :id => @scenario.to_param, :scenario => { :title => "Bar" },
|
95
|
+
:story_id => @story.to_param, :iteration_id => @iteration.to_param
|
96
|
+
end
|
97
|
+
should "redirect to show" do
|
98
|
+
assert_redirected_to iteration_story_scenario_path(@iteration, assigns(:story), assigns(:scenario))
|
99
|
+
end
|
73
100
|
end
|
74
101
|
|
75
|
-
|
76
|
-
|
77
|
-
|
102
|
+
context "with invalid params" do
|
103
|
+
setup do
|
104
|
+
put :update, :id => @scenario.to_param, :scenario => { :title => "" },
|
105
|
+
:story_id => @story.to_param, :iteration_id => @iteration.to_param
|
106
|
+
end
|
78
107
|
|
79
|
-
|
80
|
-
|
108
|
+
should "redisplay" do
|
109
|
+
assert_response :success
|
110
|
+
end
|
111
|
+
|
112
|
+
should "use edit template" do
|
113
|
+
assert_template :edit
|
114
|
+
end
|
81
115
|
end
|
82
116
|
end
|
83
|
-
end
|
84
|
-
|
85
117
|
|
86
|
-
should "show scenario" do
|
87
|
-
get :show, :id => @scenario.to_param, :story_id => @story.to_param,
|
88
|
-
:iteration_id => @iteration.to_param
|
89
|
-
assert_response :success
|
90
|
-
end
|
91
118
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
119
|
+
should "show scenario" do
|
120
|
+
get :show, :id => @scenario.to_param, :story_id => @story.to_param,
|
121
|
+
:iteration_id => @iteration.to_param
|
122
|
+
assert_response :success
|
123
|
+
end
|
97
124
|
|
98
|
-
|
99
|
-
|
100
|
-
delete :destroy, :id => @scenario.to_param, :story_id => @story.to_param,
|
125
|
+
should "get edit" do
|
126
|
+
get :edit, :id => @scenario.to_param, :story_id => @story.to_param,
|
101
127
|
:iteration_id => @iteration.to_param
|
128
|
+
assert_response :success
|
129
|
+
end
|
130
|
+
|
131
|
+
should "destroy scenario" do
|
132
|
+
assert_difference('Scenario.count', -1) do
|
133
|
+
delete :destroy, :id => @scenario.to_param, :story_id => @story.to_param,
|
134
|
+
:iteration_id => @iteration.to_param
|
135
|
+
end
|
136
|
+
assert_redirected_to iteration_story_scenarios_path(@iteration, @story.to_param)
|
102
137
|
end
|
103
|
-
assert_redirected_to iteration_story_scenarios_path(@iteration, @story.to_param)
|
104
138
|
end
|
105
139
|
end
|
106
140
|
end
|