branston 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/lib/branston/app/controllers/scenarios_controller.rb +6 -5
  2. data/lib/branston/app/controllers/stories_controller.rb +101 -89
  3. data/lib/branston/app/models/story.rb +30 -1
  4. data/lib/branston/app/models/user.rb +4 -0
  5. data/lib/branston/app/views/iterations/index.html.erb +1 -1
  6. data/lib/branston/app/views/layouts/_header.html.erb +1 -2
  7. data/lib/branston/app/views/scenarios/_scenario.html.erb +6 -3
  8. data/lib/branston/app/views/scenarios/_scenarios.html.erb +4 -2
  9. data/lib/branston/app/views/stories/_form.html.erb +15 -4
  10. data/lib/branston/app/views/stories/_story.html.erb +26 -6
  11. data/lib/branston/app/views/stories/edit.html.erb +3 -3
  12. data/lib/branston/app/views/stories/index.html.erb +22 -3
  13. data/lib/branston/app/views/stories/new.html.erb +2 -2
  14. data/lib/branston/app/views/stories/show.html.erb +3 -3
  15. data/lib/branston/config/routes.rb +7 -4
  16. data/lib/branston/coverage/app-controllers-application_controller_rb.html +1 -1
  17. data/lib/branston/coverage/app-controllers-iterations_controller_rb.html +1 -1
  18. data/lib/branston/coverage/app-controllers-outcomes_controller_rb.html +1 -1
  19. data/lib/branston/coverage/app-controllers-preconditions_controller_rb.html +1 -1
  20. data/lib/branston/coverage/app-controllers-releases_controller_rb.html +1 -1
  21. data/lib/branston/coverage/app-controllers-scenarios_controller_rb.html +18 -12
  22. data/lib/branston/coverage/app-controllers-sessions_controller_rb.html +1 -1
  23. data/lib/branston/coverage/app-controllers-stories_controller_rb.html +193 -121
  24. data/lib/branston/coverage/app-controllers-user_roles_controller_rb.html +1 -1
  25. data/lib/branston/coverage/app-controllers-users_controller_rb.html +1 -1
  26. data/lib/branston/coverage/app-helpers-application_helper_rb.html +1 -1
  27. data/lib/branston/coverage/app-helpers-iterations_helper_rb.html +1 -1
  28. data/lib/branston/coverage/app-helpers-outcomes_helper_rb.html +1 -1
  29. data/lib/branston/coverage/app-helpers-preconditions_helper_rb.html +1 -1
  30. data/lib/branston/coverage/app-helpers-releases_helper_rb.html +1 -1
  31. data/lib/branston/coverage/app-helpers-sessions_helper_rb.html +1 -1
  32. data/lib/branston/coverage/app-helpers-stories_helper_rb.html +1 -1
  33. data/lib/branston/coverage/app-helpers-user_roles_helper_rb.html +1 -1
  34. data/lib/branston/coverage/app-models-iteration_rb.html +1 -1
  35. data/lib/branston/coverage/app-models-outcome_rb.html +1 -1
  36. data/lib/branston/coverage/app-models-participation_rb.html +1 -1
  37. data/lib/branston/coverage/app-models-precondition_rb.html +1 -1
  38. data/lib/branston/coverage/app-models-release_rb.html +1 -1
  39. data/lib/branston/coverage/app-models-scenario_rb.html +1 -1
  40. data/lib/branston/coverage/app-models-story_rb.html +192 -18
  41. data/lib/branston/coverage/app-models-user_rb.html +33 -9
  42. data/lib/branston/coverage/app-models-user_role_rb.html +1 -1
  43. data/lib/branston/coverage/index.html +13 -13
  44. data/lib/branston/coverage/lib-client_rb.html +1 -1
  45. data/lib/branston/coverage/lib-faker_extras_rb.html +1 -1
  46. data/lib/branston/coverage/lib-story_generator_rb.html +1 -1
  47. data/lib/branston/db/development.sqlite3 +0 -0
  48. data/lib/branston/db/migrate/20091223100903_add_status_to_story.rb +11 -0
  49. data/lib/branston/db/pristine.sqlite3 +0 -0
  50. data/lib/branston/db/schema.rb +5 -3
  51. data/lib/branston/db/test.sqlite3 +0 -0
  52. data/lib/branston/lib/branston.rb +4 -2
  53. data/lib/branston/log/development.log +4970 -0
  54. data/lib/branston/log/test.log +88225 -0
  55. data/lib/branston/test/blueprints.rb +10 -7
  56. data/lib/branston/test/functional/scenarios_controller_test.rb +22 -15
  57. data/lib/branston/test/functional/stories_controller_test.rb +51 -30
  58. data/lib/branston/test/unit/story_test.rb +47 -7
  59. data/lib/branston/test/unit/user_test.rb +4 -0
  60. data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_flat.txt +3 -2
  61. data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_graph.html +2041 -1307
  62. data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_tree.txt +7922 -7922
  63. data/lib/branston/vendor/plugins/state_machine/CHANGELOG.rdoc +298 -0
  64. data/lib/branston/vendor/plugins/state_machine/LICENSE +20 -0
  65. data/lib/branston/vendor/plugins/state_machine/README.rdoc +466 -0
  66. data/lib/branston/vendor/plugins/state_machine/Rakefile +98 -0
  67. data/lib/branston/vendor/plugins/state_machine/examples/AutoShop_state.png +0 -0
  68. data/lib/branston/vendor/plugins/state_machine/examples/Car_state.png +0 -0
  69. data/lib/branston/vendor/plugins/state_machine/examples/TrafficLight_state.png +0 -0
  70. data/lib/branston/vendor/plugins/state_machine/examples/Vehicle_state.png +0 -0
  71. data/lib/branston/vendor/plugins/state_machine/examples/auto_shop.rb +11 -0
  72. data/lib/branston/vendor/plugins/state_machine/examples/car.rb +19 -0
  73. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/controller.rb +51 -0
  74. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb +28 -0
  75. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_edit.html.erb +24 -0
  76. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_index.html.erb +23 -0
  77. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_new.html.erb +13 -0
  78. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_show.html.erb +17 -0
  79. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/controller.rb +43 -0
  80. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/migration.rb +11 -0
  81. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/model.rb +23 -0
  82. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_edit.html.erb +25 -0
  83. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_index.html.erb +23 -0
  84. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_new.html.erb +14 -0
  85. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_show.html.erb +17 -0
  86. data/lib/branston/vendor/plugins/state_machine/examples/traffic_light.rb +7 -0
  87. data/lib/branston/vendor/plugins/state_machine/examples/vehicle.rb +31 -0
  88. data/lib/branston/vendor/plugins/state_machine/init.rb +1 -0
  89. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/assertions.rb +36 -0
  90. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/callback.rb +189 -0
  91. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/condition_proxy.rb +94 -0
  92. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/eval_helpers.rb +67 -0
  93. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/event.rb +252 -0
  94. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/event_collection.rb +122 -0
  95. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/extensions.rb +149 -0
  96. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/guard.rb +230 -0
  97. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record/locale.rb +11 -0
  98. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record/observer.rb +41 -0
  99. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record.rb +492 -0
  100. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/data_mapper/observer.rb +139 -0
  101. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/data_mapper.rb +351 -0
  102. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/sequel.rb +322 -0
  103. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations.rb +68 -0
  104. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/machine.rb +1467 -0
  105. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/machine_collection.rb +155 -0
  106. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/matcher.rb +123 -0
  107. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/matcher_helpers.rb +54 -0
  108. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/node_collection.rb +152 -0
  109. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/state.rb +249 -0
  110. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/state_collection.rb +112 -0
  111. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/transition.rb +394 -0
  112. data/lib/branston/vendor/plugins/state_machine/lib/state_machine.rb +388 -0
  113. data/lib/branston/vendor/plugins/state_machine/state_machine.gemspec +30 -0
  114. data/lib/branston/vendor/plugins/state_machine/tasks/state_machine.rake +1 -0
  115. data/lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb +30 -0
  116. data/lib/branston/vendor/plugins/state_machine/test/classes/switch.rb +11 -0
  117. data/lib/branston/vendor/plugins/state_machine/test/functional/state_machine_test.rb +941 -0
  118. data/lib/branston/vendor/plugins/state_machine/test/test_helper.rb +4 -0
  119. data/lib/branston/vendor/plugins/state_machine/test/unit/assertions_test.rb +40 -0
  120. data/lib/branston/vendor/plugins/state_machine/test/unit/callback_test.rb +455 -0
  121. data/lib/branston/vendor/plugins/state_machine/test/unit/condition_proxy_test.rb +328 -0
  122. data/lib/branston/vendor/plugins/state_machine/test/unit/eval_helpers_test.rb +120 -0
  123. data/lib/branston/vendor/plugins/state_machine/test/unit/event_collection_test.rb +326 -0
  124. data/lib/branston/vendor/plugins/state_machine/test/unit/event_test.rb +743 -0
  125. data/lib/branston/vendor/plugins/state_machine/test/unit/guard_test.rb +908 -0
  126. data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/active_record_test.rb +1367 -0
  127. data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/data_mapper_test.rb +962 -0
  128. data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/sequel_test.rb +859 -0
  129. data/lib/branston/vendor/plugins/state_machine/test/unit/integrations_test.rb +42 -0
  130. data/lib/branston/vendor/plugins/state_machine/test/unit/invalid_event_test.rb +7 -0
  131. data/lib/branston/vendor/plugins/state_machine/test/unit/invalid_transition_test.rb +7 -0
  132. data/lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb +938 -0
  133. data/lib/branston/vendor/plugins/state_machine/test/unit/machine_test.rb +2004 -0
  134. data/lib/branston/vendor/plugins/state_machine/test/unit/matcher_helpers_test.rb +37 -0
  135. data/lib/branston/vendor/plugins/state_machine/test/unit/matcher_test.rb +155 -0
  136. data/lib/branston/vendor/plugins/state_machine/test/unit/node_collection_test.rb +207 -0
  137. data/lib/branston/vendor/plugins/state_machine/test/unit/state_collection_test.rb +280 -0
  138. data/lib/branston/vendor/plugins/state_machine/test/unit/state_machine_test.rb +31 -0
  139. data/lib/branston/vendor/plugins/state_machine/test/unit/state_test.rb +795 -0
  140. data/lib/branston/vendor/plugins/state_machine/test/unit/transition_test.rb +1212 -0
  141. metadata +81 -2
@@ -63,19 +63,22 @@ end
63
63
 
64
64
  Scenario.blueprint do
65
65
  title
66
- story
67
66
  end
68
67
 
69
68
  Story.blueprint do
70
69
  title
70
+ iteration
71
71
  description
72
72
  points { 2 }
73
+ author { User.make }
73
74
  end
74
75
 
75
76
  Story.blueprint(:in_progress) do
76
- description
77
- points { 2 }
78
- iteration
77
+ status { 'in_progress' }
78
+ end
79
+
80
+ Story.blueprint(:completed) do
81
+ status { 'completed' }
79
82
  end
80
83
 
81
84
  Outcome.blueprint do
@@ -91,12 +94,12 @@ module Factory
91
94
 
92
95
  def make_story(story_options = {})
93
96
  story = Story.make(story_options)
94
- 2.times { story.scenarios << make_scenario }
97
+ 2.times { story.scenarios << make_scenario(story) }
95
98
  return story
96
99
  end
97
100
 
98
- def make_scenario
99
- scenario = Scenario.make
101
+ def make_scenario(story)
102
+ scenario = Scenario.make(:story => story)
100
103
  scenario.preconditions.make
101
104
  scenario.preconditions.make(:longer)
102
105
  2.times { scenario.outcomes.make }
@@ -5,18 +5,19 @@ class ScenariosControllerTest < ActionController::TestCase
5
5
  context "The ScenariosController" do
6
6
  setup do
7
7
  login_as(User.make)
8
- @scenario = Scenario.make
9
- @story = @scenario.story
8
+ @story = Factory.make_story
9
+ @iteration = @story.iteration
10
+ @scenario = @story.scenarios.first
10
11
  end
11
12
 
12
13
  should "get index" do
13
- get :index, :story_id => @story.to_param
14
+ get :index, :story_id => @story.to_param, :iteration_id => @iteration.to_param
14
15
  assert_response :success
15
16
  assert_not_nil assigns(:scenarios)
16
17
  end
17
18
 
18
19
  should "get new" do
19
- get :new, :story_id => @story.to_param
20
+ get :new, :story_id => @story.to_param, :iteration_id => @iteration.to_param
20
21
  assert_response :success
21
22
  end
22
23
 
@@ -24,12 +25,13 @@ class ScenariosControllerTest < ActionController::TestCase
24
25
  context "with valid params" do
25
26
  setup do
26
27
  assert_difference('Scenario.count') do
27
- post :create, :scenario => { :title => "Foo" }, :story_id => @story.to_param
28
+ post :create, :scenario => { :title => "Foo" }, :story_id => @story.to_param,
29
+ :iteration_id => @iteration.to_param
28
30
  end
29
31
  end
30
32
 
31
33
  should "redirect to show" do
32
- assert_redirected_to story_scenario_path(assigns(:story), assigns(:scenario))
34
+ assert_redirected_to iteration_story_scenario_path(@iteration, assigns(:story), assigns(:scenario))
33
35
  end
34
36
 
35
37
  end
@@ -37,7 +39,8 @@ class ScenariosControllerTest < ActionController::TestCase
37
39
  context "with invalid params" do
38
40
  setup do
39
41
  assert_no_difference('Scenario.count') do
40
- post :create, :scenario => { }, :story_id => @story.to_param
42
+ post :create, :scenario => { }, :story_id => @story.to_param,
43
+ :iteration_id => @iteration.to_param
41
44
  end
42
45
  end
43
46
 
@@ -52,20 +55,21 @@ class ScenariosControllerTest < ActionController::TestCase
52
55
  end
53
56
  end
54
57
 
55
-
56
58
  context "updating a scenario" do
57
59
  context "with valid params" do
58
60
  setup do
59
- put :update, :id => @scenario.to_param, :scenario => { :title => "Bar" }, :story_id => @story.to_param
61
+ put :update, :id => @scenario.to_param, :scenario => { :title => "Bar" },
62
+ :story_id => @story.to_param, :iteration_id => @iteration.to_param
60
63
  end
61
64
  should "redirect to show" do
62
- assert_redirected_to story_scenario_path(assigns(:story), assigns(:scenario))
65
+ assert_redirected_to iteration_story_scenario_path(@iteration, assigns(:story), assigns(:scenario))
63
66
  end
64
67
  end
65
68
 
66
69
  context "with invalid params" do
67
70
  setup do
68
- put :update, :id => @scenario.to_param, :scenario => { :title => "" }, :story_id => @story.to_param
71
+ put :update, :id => @scenario.to_param, :scenario => { :title => "" },
72
+ :story_id => @story.to_param, :iteration_id => @iteration.to_param
69
73
  end
70
74
 
71
75
  should "redisplay" do
@@ -80,20 +84,23 @@ class ScenariosControllerTest < ActionController::TestCase
80
84
 
81
85
 
82
86
  should "show scenario" do
83
- get :show, :id => @scenario.to_param, :story_id => @story.to_param
87
+ get :show, :id => @scenario.to_param, :story_id => @story.to_param,
88
+ :iteration_id => @iteration.to_param
84
89
  assert_response :success
85
90
  end
86
91
 
87
92
  should "get edit" do
88
- get :edit, :id => @scenario.to_param, :story_id => @story.to_param
93
+ get :edit, :id => @scenario.to_param, :story_id => @story.to_param,
94
+ :iteration_id => @iteration.to_param
89
95
  assert_response :success
90
96
  end
91
97
 
92
98
  should "destroy scenario" do
93
99
  assert_difference('Scenario.count', -1) do
94
- delete :destroy, :id => @scenario.to_param, :story_id => @story.to_param
100
+ delete :destroy, :id => @scenario.to_param, :story_id => @story.to_param,
101
+ :iteration_id => @iteration.to_param
95
102
  end
96
- assert_redirected_to story_scenarios_path(@story.to_param)
103
+ assert_redirected_to iteration_story_scenarios_path(@iteration, @story.to_param)
97
104
  end
98
105
  end
99
106
  end
@@ -4,51 +4,65 @@ class StoriesControllerTest < ActionController::TestCase
4
4
 
5
5
  context "The StoriesController" do
6
6
  setup do
7
- @story = Factory.make_story
7
+ @iteration = Iteration.make
8
+ @story = Factory.make_story(:iteration => @iteration)
9
+ @in_progress = Factory.make_story(:iteration => @iteration, :status => "in_progress")
10
+ @completed = Factory.make_story(:iteration => @iteration, :status => "completed")
11
+
12
+ @some_other_iteration = Iteration.make
13
+ @later = Story.make(:iteration => @some_other_iteration)
14
+ end
15
+
16
+ teardown do
17
+ feature_file = FEATURE_PATH + @story.feature_filename
18
+ FileUtils.rm feature_file if File.exists? feature_file
19
+ step_file = FEATURE_PATH + @story.step_filename
20
+ FileUtils.rm step_file if File.exists? step_file
8
21
  end
9
22
 
10
23
  context "with a logged-in user" do
11
- setup do
12
- login_as(User.make)
13
- end
14
-
15
- teardown do
16
- feature_file = FEATURE_PATH + @story.feature_filename
17
- FileUtils.rm feature_file if File.exists? feature_file
18
- step_file = FEATURE_PATH + @story.step_filename
19
- FileUtils.rm step_file if File.exists? step_file
24
+ setup do
25
+ @user = User.make
26
+ login_as(@user)
20
27
  end
21
28
 
22
- should "show a list of all the stories" do
23
- get :index
29
+ should "show a list of all the stories in the current iteration" do
30
+ get :index, :iteration_id => @iteration.to_param
24
31
  assert_response :success
25
32
  assert_not_nil assigns(:backlog_stories)
33
+ assert_not_nil assigns(:completed_stories)
34
+ assert_not_nil assigns(:current_stories)
35
+ assert_equal 1, assigns(:backlog_stories).size
36
+ assert_equal 1, assigns(:completed_stories).size
37
+ assert_equal 1, assigns(:current_stories).size
38
+ assert assigns(:backlog_stories).include? @story
39
+ assert assigns(:current_stories).include? @in_progress
40
+ assert assigns(:completed_stories).include? @completed
26
41
  end
27
42
 
28
43
  should "show a form to edit stories" do
29
- get :edit, :id => @story.to_param
44
+ get :edit, :id => @story.to_param, :iteration_id => @iteration.to_param
30
45
  assert_response :success
31
46
  assert assigns(:iterations)
32
47
  end
33
48
 
34
49
  should "show a form to add stories" do
35
- get :new
50
+ get :new, :iteration_id => @iteration.to_param
36
51
  assert_response :success
37
52
  assert assigns(:iterations)
38
53
  end
39
54
 
40
-
41
-
42
55
  should "delete a story" do
43
56
  assert_difference('Story.count', -1) do
44
- delete :destroy, :id => @story.to_param
57
+ delete :destroy, :id => @story.to_param, :iteration_id => @iteration.to_param
45
58
  end
46
59
 
47
- assert_redirected_to stories_path
60
+ assert_redirected_to iteration_stories_path(@iteration)
48
61
  end
49
62
 
50
63
  should "generate the cucumber feature file for a story" do
51
- get :generate_feature, :id => @story.to_param, :path => 'test/features/'
64
+ get :generate_feature, :id => @story.to_param, :path => 'test/features/',
65
+ :iteration_id => @iteration.to_param
52
66
  assert_response :success
53
67
  assert File.exists? FEATURE_PATH + @story.feature_filename
54
68
  assert File.exists? FEATURE_PATH + @story.step_filename
@@ -59,22 +73,27 @@ class StoriesControllerTest < ActionController::TestCase
59
73
  context "with valid params" do
60
74
  setup do
61
75
  assert_difference("Story.count") do
62
- post :create, :story => Story.plan
76
+ post :create, :story => Story.plan, :iteration_id => @iteration.to_param
63
77
  end
64
78
  end
65
79
 
66
80
  should "redirect to show" do
67
- assert_redirected_to stories_path
81
+ assert_redirected_to iteration_stories_path(@iteration)
82
+ end
83
+
84
+ should "be associated with an iteration" do
85
+ assert assigns(:story).iteration
68
86
  end
69
87
 
70
- should "not be associated with an iteration" do
71
- assert !assigns(:story).iteration
88
+ should "remember who authored it" do
89
+ assert_equal @user, assigns(:story).author
72
90
  end
73
91
 
74
92
  context "including an iteration id" do
75
93
  setup do
76
94
  assert_difference("Story.count") do
77
- post :create, :story => Story.plan(:in_progress)
95
+ post :create, :story => Story.plan(:in_progress),
96
+ :iteration_id => @iteration.to_param
78
97
  end
79
98
  end
80
99
 
@@ -87,7 +106,7 @@ class StoriesControllerTest < ActionController::TestCase
87
106
  context "with invalid params" do
88
107
  setup do
89
108
  assert_no_difference("Story.count") do
90
- post :create, :story => {}
109
+ post :create, :story => {}, :iteration_id => @iteration.to_param
91
110
  end
92
111
  end
93
112
 
@@ -102,19 +121,21 @@ class StoriesControllerTest < ActionController::TestCase
102
121
  context "with valid parameters" do
103
122
  setup do
104
123
  assert_no_difference("Story.count") do
105
- put :update,{ :id => @story.to_param, :story => {:description => "bar"}}
124
+ put :update,{ :id => @story.to_param, :story => {:description => "bar"},
125
+ :iteration_id => @iteration.to_param }
106
126
  end
107
127
  end
108
128
 
109
129
  should "redirect to show" do
110
- assert_redirected_to story_url(assigns(:story))
130
+ assert_redirected_to iteration_story_path(@iteration, @story)
111
131
  end
112
132
 
113
133
  end
114
134
 
115
135
  context "with invalid parameters" do
116
136
  setup do
117
- put :update, :id => @story.to_param, :story => {:description => ""}
137
+ put :update, :id => @story.to_param, :story => {:description => ""},
138
+ :iteration_id => @iteration.to_param
118
139
  end
119
140
 
120
141
  should "redisplay the edit template" do
@@ -129,12 +150,12 @@ class StoriesControllerTest < ActionController::TestCase
129
150
  context "Without logging in, the StoriesController" do
130
151
 
131
152
  should "show details about a story" do
132
- get :show, :id => @story.to_param
153
+ get :show, :id => @story.to_param, :iteration_id => @iteration.to_param
133
154
  assert_response :success
134
155
  end
135
156
 
136
157
  should "fail gracefully if the slug is not found" do
137
- get :show, :id => 'none-such-story'
158
+ get :show, :id => 'none-such-story', :iteration_id => @iteration.to_param
138
159
  assert_response 404
139
160
  end
140
161
  end
@@ -22,6 +22,34 @@ class StoryTest < ActiveSupport::TestCase
22
22
  FileUtils.rm @step_file if @step_file != nil and File.exists? @step_file
23
23
  end
24
24
 
25
+ should "start life with status new" do
26
+ assert @story.new?
27
+ end
28
+
29
+ context "transisted to in_progress" do
30
+ setup do
31
+ assert @story.assign
32
+ end
33
+
34
+ should "transist to in_progress" do
35
+ assert @story.in_progress?
36
+ end
37
+
38
+ context "then transisted to completed" do
39
+ setup do
40
+ assert @story.finish
41
+ end
42
+
43
+ should "transist to completed" do
44
+ assert @story.completed?
45
+ end
46
+
47
+ should "set the completed date when in the completed state" do
48
+ assert_equal Date.today, @story.completed_date
49
+ end
50
+ end
51
+ end
52
+
25
53
  should "set a slug when its saved" do
26
54
  assert_not_nil @story.slug
27
55
  assert_equal 'product-search', @story.slug
@@ -112,8 +140,6 @@ class StoryTest < ActiveSupport::TestCase
112
140
  assert_equal "end\n", f.gets
113
141
  assert_equal "\n", f.gets
114
142
 
115
-
116
-
117
143
  outcome = @story.scenarios.last.outcomes[0]
118
144
  assert_equal "Then #{regexp(outcome.to_s)} do |a|\n", f.gets
119
145
  assert_equal "\t#TODO: Define these steps\n", f.gets
@@ -135,21 +161,35 @@ class StoryTest < ActiveSupport::TestCase
135
161
  end
136
162
 
137
163
  end
138
-
164
+
139
165
  context "The Story class" do
140
166
 
141
167
  should "have an in_progress named_scope" do
142
168
  assert Story.respond_to?("in_progress")
143
169
  end
144
170
 
145
- context "named_scope in_progress" do
171
+ context "named_scope in_progress" do
146
172
  setup do
147
- Story.make
148
- Story.make(:in_progress)
173
+ @story = Story.make
174
+ @in_progress = Story.make(:in_progress)
175
+ @completed = Story.make(:completed)
176
+ @iteration = @story.iteration
149
177
  end
150
178
 
151
179
  should "only find stories that are assigned to an iteration" do
152
- assert_equal 1, Story.in_progress.count
180
+ assert_equal @story, Story.for_iteration(@iteration.id).first
181
+ end
182
+
183
+ should "only find stories that are unassigned" do
184
+ assert_equal @story, Story.unassigned.first
185
+ end
186
+
187
+ should "only find stories that are in progress" do
188
+ assert_equal @in_progress, Story.in_progress.first
189
+ end
190
+
191
+ should "only find stories that are completed" do
192
+ assert_equal @completed, Story.completed.first
153
193
  end
154
194
  end
155
195
 
@@ -57,6 +57,10 @@ class UserTest < ActiveSupport::TestCase
57
57
  setup do
58
58
  @quentin = User.make(:quentin)
59
59
  end
60
+
61
+ should "print its login when to_s is called" do
62
+ assert_equal "quentin", @quentin.to_s
63
+ end
60
64
 
61
65
  should "reset_password" do
62
66
  @quentin.update_attributes(:password => 'new password', :password_confirmation => 'new password')
@@ -1,7 +1,8 @@
1
- Thread ID: 69928266760620
1
+ Thread ID: 70273854970300
2
2
  Total: 0.020000
3
3
 
4
4
  %self total self wait child calls name
5
- 50.00 0.01 0.01 0.00 0.00 2 ActiveSupport::MessageVerifier#generate_digest
5
+ 50.00 0.01 0.01 0.00 0.00 1 <Module::Base64>#encode64
6
+ 50.00 0.01 0.01 0.00 0.00 11 Mime::Type::AcceptItem#<=>
6
7
 
7
8