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
@@ -17,6 +17,28 @@ end
|
|
17
17
|
|
18
18
|
# Model class blueprints
|
19
19
|
|
20
|
+
User.blueprint do
|
21
|
+
login
|
22
|
+
email
|
23
|
+
role { "customer" }
|
24
|
+
password { 'monkey' }
|
25
|
+
password_confirmation { 'monkey' }
|
26
|
+
end
|
27
|
+
|
28
|
+
User.blueprint(:quentin) do
|
29
|
+
login 'quentin'
|
30
|
+
state 'active'
|
31
|
+
salt { '356a192b7913b04c54574d18c28d46e6395428ab' }
|
32
|
+
crypted_password { 'caca9d7480e94bdd00036b4da5cdc3bb3e96da7f' }
|
33
|
+
created_at { 5.days.ago.to_s :db }
|
34
|
+
remember_token_expires_at { 1.days.from_now.to_s }
|
35
|
+
remember_token { '77de68daecd823babbb58edb1c8e14d7106e83bb' }
|
36
|
+
end
|
37
|
+
|
38
|
+
User.blueprint(:admin) do
|
39
|
+
role { "admin" }
|
40
|
+
end
|
41
|
+
|
20
42
|
Iteration.blueprint do
|
21
43
|
velocity { 50 }
|
22
44
|
name
|
@@ -41,26 +63,6 @@ Release.blueprint do
|
|
41
63
|
notes
|
42
64
|
end
|
43
65
|
|
44
|
-
User.blueprint do
|
45
|
-
login
|
46
|
-
email
|
47
|
-
password { 'monkey' }
|
48
|
-
password_confirmation { 'monkey' }
|
49
|
-
end
|
50
|
-
|
51
|
-
User.blueprint(:quentin) do
|
52
|
-
login 'quentin'
|
53
|
-
salt { '356a192b7913b04c54574d18c28d46e6395428ab' }
|
54
|
-
crypted_password { 'caca9d7480e94bdd00036b4da5cdc3bb3e96da7f' }
|
55
|
-
created_at { 5.days.ago.to_s :db }
|
56
|
-
remember_token_expires_at { 1.days.from_now.to_s }
|
57
|
-
remember_token { '77de68daecd823babbb58edb1c8e14d7106e83bb' }
|
58
|
-
end
|
59
|
-
|
60
|
-
UserRole.blueprint do
|
61
|
-
name
|
62
|
-
end
|
63
|
-
|
64
66
|
Scenario.blueprint do
|
65
67
|
title
|
66
68
|
end
|
@@ -85,14 +87,6 @@ Story.blueprint(:completed) do
|
|
85
87
|
status { 'completed' }
|
86
88
|
end
|
87
89
|
|
88
|
-
Outcome.blueprint do
|
89
|
-
description
|
90
|
-
end
|
91
|
-
|
92
|
-
Precondition.blueprint do
|
93
|
-
description
|
94
|
-
end
|
95
|
-
|
96
90
|
module Factory
|
97
91
|
class << self
|
98
92
|
|
@@ -3,176 +3,212 @@ require 'test_helper'
|
|
3
3
|
class IterationsControllerTest < ActionController::TestCase
|
4
4
|
|
5
5
|
context "The IterationsController" 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
|
6
12
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
13
|
+
should "redirect to login" do
|
14
|
+
assert_redirected_to new_session_path
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
18
26
|
end
|
19
27
|
|
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
|
20
36
|
end
|
21
37
|
|
22
|
-
context "when
|
23
|
-
|
38
|
+
context "when the user is logged in" do
|
24
39
|
setup do
|
40
|
+
@user = User.make
|
25
41
|
login_as(@user)
|
26
|
-
@iteration = Iteration.make
|
27
42
|
end
|
28
43
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
44
|
+
context "when there are no iterations yet" do
|
45
|
+
setup do
|
46
|
+
get :index
|
47
|
+
end
|
34
48
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
49
|
+
should "get index" do
|
50
|
+
assert_response :success
|
51
|
+
assert_not_nil assigns(:iterations)
|
52
|
+
end
|
39
53
|
end
|
40
54
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
55
|
+
context "when at least one iteration exists" do
|
56
|
+
setup do
|
57
|
+
@iteration = Iteration.make
|
58
|
+
end
|
46
59
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
60
|
+
context "on GET to index" do
|
61
|
+
setup do
|
62
|
+
get :index
|
63
|
+
end
|
51
64
|
|
52
|
-
|
53
|
-
|
54
|
-
|
65
|
+
should "work" do
|
66
|
+
assert_response :success
|
67
|
+
assert_not_nil assigns(:iterations)
|
68
|
+
end
|
55
69
|
end
|
56
70
|
|
57
|
-
|
58
|
-
|
71
|
+
should "get edit" do
|
72
|
+
get :edit, :id => @iteration.to_param
|
73
|
+
assert_response :success
|
74
|
+
assert assigns(:releases)
|
75
|
+
end
|
76
|
+
|
77
|
+
should "get new" do
|
78
|
+
get :new
|
79
|
+
assert_response :success
|
80
|
+
assert assigns(:releases)
|
81
|
+
end
|
59
82
|
|
60
|
-
context "creating an iteration" do
|
61
83
|
|
62
|
-
context "
|
84
|
+
context "on GET to show" do
|
63
85
|
setup do
|
64
|
-
|
65
|
-
assert_difference("Iteration.count") do
|
66
|
-
post :create, :iteration => Iteration.plan
|
67
|
-
end
|
86
|
+
get :show, :id => @iteration.to_param
|
68
87
|
end
|
69
|
-
|
70
|
-
|
71
|
-
assert assigns(:iteration).release.nil?
|
88
|
+
should "show iteration" do
|
89
|
+
assert_response :success
|
72
90
|
end
|
91
|
+
end
|
73
92
|
|
74
|
-
|
75
|
-
|
93
|
+
should "destroy iteration" do
|
94
|
+
assert_difference('Iteration.count', -1) do
|
95
|
+
delete :destroy, :id => @iteration.to_param
|
76
96
|
end
|
77
97
|
|
78
|
-
|
98
|
+
assert_redirected_to iterations_path
|
99
|
+
end
|
100
|
+
|
101
|
+
context "creating an iteration" do
|
102
|
+
context "with valid params" do
|
79
103
|
setup do
|
104
|
+
login_as(@user)
|
80
105
|
assert_difference("Iteration.count") do
|
81
|
-
post :create, :iteration => Iteration.plan
|
106
|
+
post :create, :iteration => Iteration.plan
|
82
107
|
end
|
83
108
|
end
|
84
109
|
|
85
|
-
should "be assigned to a release" do
|
86
|
-
assert assigns(:iteration).release
|
110
|
+
should "not be assigned to a release" do
|
111
|
+
assert assigns(:iteration).release.nil?
|
87
112
|
end
|
88
|
-
end
|
89
113
|
|
90
|
-
|
114
|
+
should "redirect to show" do
|
115
|
+
assert_redirected_to iterations_path
|
116
|
+
end
|
91
117
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
118
|
+
context "including a release_id" do
|
119
|
+
setup do
|
120
|
+
assert_difference("Iteration.count") do
|
121
|
+
post :create, :iteration => Iteration.plan.merge(:release_id => Release.make.to_param)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
should "be assigned to a release" do
|
126
|
+
assert assigns(:iteration).release
|
127
|
+
end
|
97
128
|
end
|
98
129
|
end
|
99
130
|
|
100
|
-
|
101
|
-
|
102
|
-
|
131
|
+
context "with invalid params" do
|
132
|
+
setup do
|
133
|
+
login_as(@user)
|
134
|
+
assert_no_difference("Iteration.count") do
|
135
|
+
post :create, :iteration => {}
|
136
|
+
end
|
137
|
+
end
|
103
138
|
|
104
|
-
|
105
|
-
|
106
|
-
|
139
|
+
should "redisplay" do
|
140
|
+
assert_template 'new'
|
141
|
+
end
|
107
142
|
|
143
|
+
should "retrieve all releases" do
|
144
|
+
assert assigns(:releases)
|
145
|
+
end
|
146
|
+
end
|
108
147
|
end
|
109
|
-
end
|
110
148
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
149
|
+
context "updating an iteration" do
|
150
|
+
context "with valid parameters" do
|
151
|
+
setup do
|
152
|
+
login_as(@user)
|
153
|
+
assert_no_difference("Iteration.count") do
|
154
|
+
put :update,{ :id => @iteration.to_param, :iteration => {:name => "bar"}}
|
155
|
+
end
|
117
156
|
end
|
118
|
-
end
|
119
157
|
|
120
|
-
|
121
|
-
|
158
|
+
should "redirect to show" do
|
159
|
+
assert_redirected_to iterations_path
|
160
|
+
end
|
161
|
+
|
162
|
+
context "including a release_id" do
|
163
|
+
setup do
|
164
|
+
put :update, :id => @iteration.to_param, :iteration => {:release_id => Release.make.to_param}
|
165
|
+
end
|
166
|
+
|
167
|
+
should "be assigned to a release" do
|
168
|
+
assert assigns(:iteration).release
|
169
|
+
end
|
170
|
+
end
|
122
171
|
end
|
123
172
|
|
124
|
-
context "
|
173
|
+
context "with invalid parameters" do
|
125
174
|
setup do
|
126
|
-
put :update, :id => @iteration.
|
175
|
+
put :update, :id => @iteration.id, :iteration => {:name => ""}
|
127
176
|
end
|
128
177
|
|
129
|
-
should "
|
130
|
-
|
178
|
+
should "redisplay the edit template" do
|
179
|
+
assert_template "edit"
|
131
180
|
end
|
132
|
-
end
|
133
181
|
|
182
|
+
should "retrieve all releases" do
|
183
|
+
assert assigns(:releases)
|
184
|
+
end
|
185
|
+
end
|
134
186
|
end
|
187
|
+
end
|
135
188
|
|
136
|
-
|
137
|
-
|
138
|
-
|
189
|
+
context "showing an iteration with 5 stories" do
|
190
|
+
setup do
|
191
|
+
@iteration = Iteration.make
|
192
|
+
5.times do
|
193
|
+
@iteration.stories.push Story.make(:completed)
|
139
194
|
end
|
195
|
+
get :show, :id => @iteration.to_param
|
196
|
+
end
|
140
197
|
|
141
|
-
|
142
|
-
|
143
|
-
|
198
|
+
should "work" do
|
199
|
+
assert_response :success
|
200
|
+
end
|
144
201
|
|
145
|
-
|
146
|
-
|
147
|
-
|
202
|
+
should "successfully respond with iteration data" do
|
203
|
+
assert assigns(:iteration)
|
204
|
+
assert assigns(:iteration_data)
|
205
|
+
end
|
206
|
+
|
207
|
+
should "have 5 stories assigned to it" do
|
208
|
+
assert_equal assigns(:iteration).stories.length, 5
|
148
209
|
end
|
149
210
|
end
|
150
211
|
end
|
151
|
-
|
152
|
-
context "showing an iteration" do
|
153
|
-
|
154
|
-
setup do
|
155
|
-
|
156
|
-
login_as(@user)
|
157
|
-
|
158
|
-
@iteration = Iteration.make
|
159
|
-
5.times do
|
160
|
-
@iteration.stories.push Story.make(:completed)
|
161
|
-
end
|
162
|
-
|
163
|
-
get :show, :id => @iteration.to_param
|
164
|
-
|
165
|
-
end
|
166
|
-
|
167
|
-
should "successfully respond with iteration data" do
|
168
|
-
assert_response :success
|
169
|
-
assert assigns(:iteration)
|
170
|
-
assert assigns(:iteration_data)
|
171
|
-
end
|
172
|
-
|
173
|
-
end
|
174
|
-
|
175
212
|
end
|
176
|
-
|
177
213
|
end
|
178
214
|
|
@@ -3,94 +3,128 @@ require 'test_helper'
|
|
3
3
|
class OutcomesControllerTest < ActionController::TestCase
|
4
4
|
|
5
5
|
context "The OutcomesController" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
should "show a list of all the outcomes" do
|
13
|
-
get :index, :scenario_id => @scenario.id
|
14
|
-
assert_response :success
|
15
|
-
assert_not_nil assigns(:outcomes)
|
16
|
-
end
|
17
|
-
|
18
|
-
should "show a form to add stories" 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('Outcome.count') do
|
27
|
-
post :create, :outcome => { :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, :outcome => { }, :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
|
47
35
|
end
|
48
36
|
end
|
49
37
|
|
50
|
-
context "
|
51
|
-
|
52
|
-
|
53
|
-
|
38
|
+
context "when the user is logged in" do
|
39
|
+
setup do
|
40
|
+
login_as(User.make)
|
41
|
+
@scenario = Scenario.make
|
42
|
+
@outcome = Outcome.make
|
43
|
+
end
|
44
|
+
|
45
|
+
should "show a list of all the outcomes" do
|
46
|
+
get :index, :scenario_id => @scenario.id
|
47
|
+
assert_response :success
|
48
|
+
assert_not_nil assigns(:outcomes)
|
49
|
+
end
|
50
|
+
|
51
|
+
should "show a form to add stories" do
|
52
|
+
get :new, :scenario_id => @scenario.id
|
53
|
+
assert_response :success
|
54
|
+
end
|
55
|
+
|
56
|
+
context "creating an outcome" do
|
57
|
+
context "with valid params" do
|
58
|
+
setup do
|
59
|
+
assert_difference('Outcome.count') do
|
60
|
+
post :create, :outcome => { :description => "Foo" }, :scenario_id => @scenario.id
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
should "redirect after creation" do
|
65
|
+
assert_redirected_to outcome_path(assigns(:outcome))
|
66
|
+
end
|
67
|
+
|
54
68
|
end
|
55
69
|
|
56
|
-
|
57
|
-
|
70
|
+
context "with invalid params" do
|
71
|
+
setup do
|
72
|
+
assert_no_difference('Outcome.count') do
|
73
|
+
post :create, :outcome => { }, :scenario_id => @scenario.id
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
should "redisplay" do
|
78
|
+
assert_response :success
|
79
|
+
end
|
58
80
|
end
|
59
81
|
end
|
60
82
|
|
61
|
-
context "
|
62
|
-
|
63
|
-
|
83
|
+
context "updating an outcome" do
|
84
|
+
context "with valid params" do
|
85
|
+
setup do
|
86
|
+
put :update, :id => @outcome.to_param, :outcome => {:description => "bar" }, :scenario_id => @scenario.id
|
87
|
+
end
|
88
|
+
|
89
|
+
should "redirect after update" do
|
90
|
+
assert_redirected_to outcome_path(assigns(:outcome))
|
91
|
+
end
|
64
92
|
end
|
65
93
|
|
66
|
-
|
67
|
-
|
94
|
+
context "with invalid params" do
|
95
|
+
setup do
|
96
|
+
put :update, :id => @outcome.to_param, :outcome => {:description => "" }, :scenario_id => @scenario.id
|
97
|
+
end
|
98
|
+
|
99
|
+
should "redisplay" do
|
100
|
+
assert_response :success
|
101
|
+
end
|
68
102
|
end
|
69
103
|
end
|
70
|
-
end
|
71
104
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
105
|
+
should "update outcome" do
|
106
|
+
put :update, :id => @outcome.to_param, :outcome => { }, :scenario_id => @scenario.id
|
107
|
+
assert_redirected_to outcome_path(assigns(:outcome))
|
108
|
+
end
|
76
109
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
110
|
+
should "show outcome" do
|
111
|
+
get :show, :id => @outcome.to_param, :scenario_id => @scenario.id
|
112
|
+
assert_response :success
|
113
|
+
end
|
81
114
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
115
|
+
should "get edit" do
|
116
|
+
get :edit, :id => @outcome.to_param, :scenario_id => @scenario.id
|
117
|
+
assert_response :success
|
118
|
+
end
|
86
119
|
|
87
120
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
121
|
+
should "destroy outcome" do
|
122
|
+
assert_difference('Outcome.count', -1) do
|
123
|
+
delete :destroy, :id => @outcome.to_param
|
124
|
+
end
|
92
125
|
|
93
|
-
|
126
|
+
assert_redirected_to outcomes_path
|
127
|
+
end
|
94
128
|
end
|
95
129
|
end
|
96
130
|
end
|