backlog 0.36.2 → 0.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +16 -4
- data/Gemfile.lock +130 -0
- data/History.txt +17 -0
- data/README.txt +0 -2
- data/Rakefile +17 -7
- data/app/controllers/absences_controller.rb +1 -2
- data/app/controllers/application_controller.rb +13 -14
- data/app/controllers/application_controller.rb.rails2 +186 -0
- data/app/controllers/estimates_controller.rb +1 -1
- data/app/controllers/groups_controller.rb +3 -1
- data/app/controllers/periods_controller.rb +61 -50
- data/app/controllers/{backlogs_controller.rb → projects_controller.rb} +35 -35
- data/app/controllers/search_controller.rb +2 -2
- data/app/controllers/tasks_controller.rb +11 -11
- data/app/controllers/user_controller.rb +6 -4
- data/app/controllers/welcome_controller.rb +4 -4
- data/app/controllers/work_locks_controller.rb +2 -2
- data/app/controllers/works_controller.rb +31 -31
- data/app/helpers/application_helper.rb +2 -2
- data/app/helpers/application_helper.rb.rails2 +118 -0
- data/app/helpers/periods_helper.rb +3 -3
- data/app/helpers/{backlogs_helper.rb → projects_helper.rb} +5 -5
- data/app/helpers/user_helper.rb +2 -2
- data/app/{models → mailers}/user_notify.rb +1 -0
- data/app/models/absence.rb +2 -2
- data/{lib → app/models}/clock.rb +0 -0
- data/app/models/estimate.rb +2 -2
- data/app/models/party.rb +1 -2
- data/app/models/period.rb +17 -18
- data/app/models/{backlog.rb → project.rb} +2 -2
- data/app/models/sidebar.rb +2 -2
- data/app/models/task.rb +28 -28
- data/app/models/user.rb +5 -4
- data/app/models/work.rb +29 -23
- data/app/models/work_lock_nagger.rb +1 -1
- data/app/models/works_report_filter.rb +4 -4
- data/app/views/customers/_name_list.rhtml +1 -1
- data/app/views/layouts/_headers.rhtml +2 -1
- data/app/views/layouts/_left_top.rhtml +32 -29
- data/app/views/layouts/_shortcuts.rhtml +15 -9
- data/app/views/layouts/_shortcuts_js.rhtml +4 -4
- data/app/views/layouts/mwrt002.html.erb +44 -0
- data/app/views/periods/_burn_down_chart.rhtml +1 -1
- data/app/views/periods/_show_active.rhtml +3 -3
- data/app/views/periods/_title.rhtml +1 -1
- data/app/views/{backlogs → projects}/_buttons.rhtml +4 -4
- data/app/views/projects/_form.rhtml +44 -0
- data/app/views/projects/_name_list.rhtml +5 -0
- data/app/views/projects/edit.rhtml +14 -0
- data/app/views/{backlogs → projects}/finish_task.rjs +0 -0
- data/app/views/projects/list.rhtml +16 -0
- data/app/views/{backlogs → projects}/move_task_to_period.rjs +0 -0
- data/app/views/{backlogs → projects}/new.rhtml +1 -1
- data/app/views/{backlogs → projects}/reopen_task.rjs +0 -0
- data/app/views/{backlogs → projects}/show.rhtml +6 -6
- data/app/views/search/results.rhtml +3 -3
- data/app/views/tasks/_backlog_header.rhtml +4 -4
- data/app/views/tasks/_completed.rhtml +2 -2
- data/app/views/tasks/_form.rhtml +13 -13
- data/app/views/tasks/_task.rhtml +10 -10
- data/app/views/tasks/edit.rhtml +1 -1
- data/app/views/tasks/list.rhtml +3 -3
- data/app/views/tasks/list_started.rhtml +4 -4
- data/app/views/tasks/start_work.rjs +1 -1
- data/app/views/user/login.rhtml +1 -1
- data/app/views/user/signup.rhtml +1 -1
- data/app/views/user/welcome.rhtml +1 -1
- data/app/views/works/_description_list.rhtml +1 -1
- data/app/views/works/_form.rhtml +5 -5
- data/app/views/works/_new_row.rhtml +8 -8
- data/app/views/works/_row.rhtml +1 -1
- data/app/views/works/_task_id_list.rhtml +1 -1
- data/app/views/works/daily_work_sheet.rhtml +1 -1
- data/app/views/works/list.rhtml +5 -5
- data/app/views/works/list_excel.rhtml +2 -2
- data/app/views/works/timeliste.rhtml +14 -14
- data/app/views/works/weekly_work_sheet.rhtml +5 -5
- data/app/views/works/weekly_work_sheet_details.rhtml +5 -5
- data/backlog.gemspec +44 -0
- data/bin/backlog +5 -1
- data/config.ru +4 -0
- data/config/application.rb +10 -0
- data/config/boot.rb +12 -116
- data/config/database.yml +3 -6
- data/config/database.yml~ +17 -0
- data/config/environment.rb +28 -49
- data/config/environments/development.rb +24 -20
- data/config/environments/development.rb.rails2 +26 -0
- data/config/environments/production.rb +26 -22
- data/config/environments/test.rb +20 -15
- data/config/environments/user_environment.rb +1 -1
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/inflections.rb +10 -0
- data/config/initializers/jdbc.rb +1 -1
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/locales/en.yml +22 -11
- data/config/locales/no.yml +1 -0
- data/config/routes.rb +4 -5
- data/cruise_build.sh +6 -2
- data/db/migrate/004_add_period.rb +22 -22
- data/db/migrate/015_add_user_option.rb +5 -19
- data/db/migrate/017_increase_backlog_name_limit.rb +10 -0
- data/db/migrate/021_create_work_accounts.rb +0 -2
- data/db/migrate/20101006092700_rename_backlogs_to_projects.rb +22 -0
- data/db/migrate/20101006092700_rename_backlogs_to_projects.rb~ +22 -0
- data/db/schema.rb +27 -30
- data/db/seeds.rb +7 -0
- data/lib/array_helper.rb +0 -8
- data/lib/class_table_inheritance.rb +8 -7
- data/lib/tasks/backup.rake +3 -3
- data/lib/tasks/jdbc.rake +2 -2
- data/lib/version_from_history.rb +1 -1
- data/public/404.html +23 -7
- data/public/422.html +26 -0
- data/public/500.html +23 -6
- data/public/images/rails.png +0 -0
- data/public/javascripts/controls.js +5 -3
- data/public/javascripts/dragdrop.js +7 -6
- data/public/javascripts/effects.js +8 -13
- data/public/javascripts/prototype.js +3381 -1700
- data/public/javascripts/rails.js +175 -0
- data/public/robots.txt +5 -1
- data/script/rails +6 -0
- data/test/client/login.rb +0 -2
- data/test/client/login_test.rb +1 -1
- data/test/client/setup.rb +25 -24
- data/test/fixtures/{backlogs.yml → projects.yml} +2 -2
- data/test/fixtures/tasks.yml +9 -9
- data/test/fixtures/work_lock_subscriptions.yml +2 -2
- data/test/fixtures/works.yml +7 -7
- data/test/functional/periods_controller_test.rb +1 -1
- data/test/functional/{backlogs_controller_test.rb → projects_controller_test.rb} +22 -21
- data/test/functional/search_controller_test.rb +1 -1
- data/test/functional/tasks_controller_test.rb +17 -17
- data/test/functional/user_controller_test.rb +16 -21
- data/test/functional/welcome_controller_test.rb +4 -3
- data/test/functional/works_controller_test.rb +5 -5
- data/test/integration/user_system_test.rb +1 -1
- data/test/mocks/test/clock.rb +1 -1
- data/test/performance/browsing_test.rb +9 -0
- data/test/performance/common.rb +1 -1
- data/test/test_helper.rb +23 -6
- data/test/test_helper.rb~ +121 -0
- data/test/unit/user_test.rb +3 -3
- data/test/unit/work_test.rb +7 -7
- data/vendor/plugins/assert_cookie/lib/assert_cookie.rb +0 -2
- data/vendor/plugins/{foreign_key_migrations → dynamic_form}/MIT-LICENSE +1 -1
- data/vendor/plugins/dynamic_form/README +13 -0
- data/vendor/plugins/dynamic_form/Rakefile +10 -0
- data/vendor/plugins/dynamic_form/dynamic_form.gemspec +12 -0
- data/vendor/plugins/dynamic_form/init.rb +1 -0
- data/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb +300 -0
- data/vendor/plugins/dynamic_form/lib/action_view/locale/en.yml +8 -0
- data/vendor/plugins/dynamic_form/lib/dynamic_form.rb +5 -0
- data/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb +42 -0
- data/vendor/plugins/dynamic_form/test/dynamic_form_test.rb +370 -0
- data/vendor/plugins/dynamic_form/test/test_helper.rb +9 -0
- data/vendor/plugins/prototype_legacy_helper/lib/prototype_legacy_helper.rb +432 -0
- data/vendor/plugins/prototype_legacy_helper/test/test_prototype_helper.rb +297 -0
- data/vendor/plugins/rails_time/test/debug.log +1 -0
- data/vendor/plugins/{redhillonrails_core → verification}/MIT-LICENSE +1 -1
- data/vendor/plugins/verification/README +34 -0
- data/vendor/plugins/verification/Rakefile +22 -0
- data/vendor/plugins/verification/init.rb +3 -0
- data/vendor/plugins/verification/lib/action_controller/verification.rb +132 -0
- data/vendor/plugins/verification/test/test_helper.rb +18 -0
- data/vendor/plugins/verification/test/verification_test.rb +270 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +1 -1
- metadata +115 -134
- data/Gemfile~ +0 -4
- data/History.txt~ +0 -961
- data/LICENSE_LOCALIZATION +0 -20
- data/README_LOCALIZATION +0 -61
- data/README_RAILS +0 -180
- data/app/views/backlogs/_form.rhtml +0 -44
- data/app/views/backlogs/_name_list.rhtml +0 -5
- data/app/views/backlogs/edit.rhtml +0 -14
- data/app/views/backlogs/list.rhtml +0 -16
- data/app/views/layouts/mwrt002.rhtml +0 -43
- data/config/initializers/mongrel.rb +0 -83
- data/config/preinitializer.rb +0 -20
- data/config/warble.rb~ +0 -84
- data/db/migrate/017_insert_datek_projects.rb +0 -98
- data/lib/change_column_null_migration_fix.rb +0 -15
- data/no_test.rb~ +0 -6
- data/public/dispatch.cgi +0 -10
- data/public/dispatch.fcgi +0 -24
- data/public/dispatch.rb +0 -10
- data/script/about +0 -3
- data/script/breakpointer +0 -3
- data/script/console +0 -3
- data/script/dbconsole +0 -3
- data/script/destroy +0 -3
- data/script/generate +0 -3
- data/script/performance/benchmarker +0 -3
- data/script/performance/profiler +0 -3
- data/script/plugin +0 -3
- data/script/process/inspector +0 -3
- data/script/process/reaper +0 -3
- data/script/process/spawner +0 -3
- data/script/runner +0 -3
- data/script/server +0 -3
- data/test/client/login.rb~ +0 -33
- data/test/mocks/test/user_notify.rb +0 -16
- data/vendor/plugins/foreign_key_migrations/CHANGELOG +0 -103
- data/vendor/plugins/foreign_key_migrations/README +0 -87
- data/vendor/plugins/foreign_key_migrations/about.yml +0 -5
- data/vendor/plugins/foreign_key_migrations/init.rb +0 -1
- data/vendor/plugins/foreign_key_migrations/install.rb +0 -1
- data/vendor/plugins/foreign_key_migrations/lib/foreign_key_migrations.rb +0 -3
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/base.rb +0 -22
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/abstract_adapter.rb +0 -22
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/table_definition.rb +0 -28
- data/vendor/plugins/lightwindow_helper/README +0 -33
- data/vendor/plugins/lightwindow_helper/assets/images/ajax-loading.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/arrow-down.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/arrow-up.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/black-70.png +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/black.png +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/nextlabel.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/prevlabel.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/javascripts/lightwindow.js +0 -1921
- data/vendor/plugins/lightwindow_helper/assets/stylesheets/lightwindow.css +0 -376
- data/vendor/plugins/lightwindow_helper/init.rb +0 -1
- data/vendor/plugins/lightwindow_helper/install.rb +0 -7
- data/vendor/plugins/lightwindow_helper/lib/lightwindow_helper.rb +0 -31
- data/vendor/plugins/redhillonrails_core/CHANGELOG +0 -150
- data/vendor/plugins/redhillonrails_core/README +0 -124
- data/vendor/plugins/redhillonrails_core/init.rb +0 -19
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/base.rb +0 -54
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/abstract_adapter.rb +0 -31
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/column.rb +0 -21
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/foreign_key_definition.rb +0 -26
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/index_definition.rb +0 -11
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_adapter.rb +0 -74
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_column.rb +0 -8
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/postgresql_adapter.rb +0 -99
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/schema_statements.rb +0 -16
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/sqlite3_adapter.rb +0 -9
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/table_definition.rb +0 -27
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema.rb +0 -27
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema_dumper.rb +0 -47
- data/vendor/plugins/transactional_migrations/CHANGELOG +0 -9
- data/vendor/plugins/transactional_migrations/MIT-LICENSE +0 -20
- data/vendor/plugins/transactional_migrations/README +0 -15
- data/vendor/plugins/transactional_migrations/about.yml +0 -5
- data/vendor/plugins/transactional_migrations/init.rb +0 -1
- data/vendor/plugins/transactional_migrations/lib/red_hill_consulting/transactional_migrations/active_record/migration.rb +0 -19
|
@@ -16,7 +16,7 @@ class SearchControllerTest < ActionController::TestCase
|
|
|
16
16
|
|
|
17
17
|
def test_notes
|
|
18
18
|
post :results, :q => 'hullo'
|
|
19
|
-
assert_not_nil assigns(:
|
|
19
|
+
assert_not_nil assigns(:projects)
|
|
20
20
|
assert_not_nil assigns(:tasks)
|
|
21
21
|
assert_equal 1, assigns(:tasks).size
|
|
22
22
|
assert_equal tasks(:first).id, assigns(:tasks).first.id
|
|
@@ -19,14 +19,14 @@ class TasksControllerTest < ActionController::TestCase
|
|
|
19
19
|
assert_sequences
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def test_index
|
|
23
|
-
get :index
|
|
24
|
-
assert_redirected_to :controller => '
|
|
25
|
-
end
|
|
26
|
-
|
|
22
|
+
# def test_index
|
|
23
|
+
# get :index
|
|
24
|
+
# assert_redirected_to :controller => 'projects'
|
|
25
|
+
# end
|
|
26
|
+
|
|
27
27
|
def test_list
|
|
28
28
|
get :list
|
|
29
|
-
assert_redirected_to :controller => '
|
|
29
|
+
assert_redirected_to :controller => 'projects'
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def test_list_started
|
|
@@ -59,7 +59,7 @@ class TasksControllerTest < ActionController::TestCase
|
|
|
59
59
|
def test_create
|
|
60
60
|
num_tasks = Task.count
|
|
61
61
|
|
|
62
|
-
post :create, :task => {:description => 'an important task', :
|
|
62
|
+
post :create, :task => {:description => 'an important task', :project_id => '2',
|
|
63
63
|
:period_id => periods(:active).id.to_s}
|
|
64
64
|
|
|
65
65
|
task = assigns(:task)
|
|
@@ -74,13 +74,13 @@ class TasksControllerTest < ActionController::TestCase
|
|
|
74
74
|
def test_create_without_period
|
|
75
75
|
num_tasks = Task.count
|
|
76
76
|
|
|
77
|
-
post :create, :task => {:description => 'an important task', :
|
|
77
|
+
post :create, :task => {:description => 'an important task', :project_id => '2'}
|
|
78
78
|
|
|
79
79
|
task = assigns(:task)
|
|
80
80
|
assert_equal [], task.errors.full_messages
|
|
81
81
|
|
|
82
82
|
assert_response :redirect
|
|
83
|
-
assert_redirected_to :controller => '
|
|
83
|
+
assert_redirected_to :controller => 'projects', :action => :edit, :id => 2, :task => task.id
|
|
84
84
|
|
|
85
85
|
assert_equal num_tasks + 1, Task.count
|
|
86
86
|
end
|
|
@@ -138,7 +138,7 @@ class TasksControllerTest < ActionController::TestCase
|
|
|
138
138
|
post :update, :id => 2, :task => {:period_id => ''}
|
|
139
139
|
|
|
140
140
|
assert_response :redirect
|
|
141
|
-
assert_redirected_to :controller => '
|
|
141
|
+
assert_redirected_to :controller => 'projects', :action => 'show', :id => before.project, :task => 2
|
|
142
142
|
|
|
143
143
|
after = Task.find(2)
|
|
144
144
|
assert_equal nil, after.period_id
|
|
@@ -180,13 +180,13 @@ class TasksControllerTest < ActionController::TestCase
|
|
|
180
180
|
post :end_work, :id => 1, :work => {:work_start_time => (TimeOfDay.now - 3600).to_s}
|
|
181
181
|
assert_response :redirect
|
|
182
182
|
assert_redirected_to :controller => 'works', :action => :new,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
183
|
+
'work[task_id]' => 1,
|
|
184
|
+
'work[started_on]' => Time.previous_quarter.to_date.to_s,
|
|
185
|
+
'work[start_time]' => Time.previous_quarter.time_of_day.to_s,
|
|
186
|
+
'work[completed_at]' => Time.next_quarter.iso8601,
|
|
187
|
+
'work[hours]' => "0.25",
|
|
188
|
+
'estimate[todo]' => 1.0
|
|
189
|
+
|
|
190
190
|
after = Task.find(1)
|
|
191
191
|
assert_equal 70, after.total_done
|
|
192
192
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
|
2
2
|
require 'user_controller'
|
|
3
|
-
require 'user_notify'
|
|
4
3
|
|
|
5
4
|
# Raise errors beyond the default web-based presentation
|
|
6
5
|
class UserController; def rescue_action(e) raise e end; end
|
|
@@ -16,7 +15,7 @@ class UserControllerTest < ActionController::TestCase
|
|
|
16
15
|
@request = ActionController::TestRequest.new
|
|
17
16
|
@response = ActionController::TestResponse.new
|
|
18
17
|
@request.host = "localhost"
|
|
19
|
-
|
|
18
|
+
Mail::TestMailer.inject_one_error = false
|
|
20
19
|
ActionMailer::Base.deliveries = []
|
|
21
20
|
end
|
|
22
21
|
|
|
@@ -58,17 +57,15 @@ class UserControllerTest < ActionController::TestCase
|
|
|
58
57
|
end
|
|
59
58
|
|
|
60
59
|
def test_signup
|
|
61
|
-
post_signup :login => "newuser",
|
|
62
|
-
:password => "password", :password_confirmation => "password",
|
|
63
|
-
:email => "newemail@example.com"
|
|
60
|
+
post_signup :login => "newuser", :password => "password", :password_confirmation => "password", :email => "newemail@example.com"
|
|
64
61
|
assert_not_logged_in
|
|
65
62
|
assert_redirected_to_login
|
|
66
63
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
|
67
64
|
|
|
68
65
|
mail = ActionMailer::Base.deliveries[0]
|
|
69
66
|
assert_equal "newemail@example.com", mail.to_addrs[0].to_s
|
|
70
|
-
assert_match /login:\s+\w+\n/, mail.encoded
|
|
71
|
-
assert_match /password:\s+\w+\n/, mail.encoded
|
|
67
|
+
assert_match /login:\s+\w+\s*\n/, mail.encoded
|
|
68
|
+
assert_match /password:\s+\w+\s*\n/, mail.encoded
|
|
72
69
|
user = User.find_by_email("newemail@example.com")
|
|
73
70
|
assert_match /user\[id\]=#{user.id}/, mail.encoded
|
|
74
71
|
assert_match /key=#{user.security_token}/, mail.encoded
|
|
@@ -76,10 +73,8 @@ class UserControllerTest < ActionController::TestCase
|
|
|
76
73
|
end
|
|
77
74
|
|
|
78
75
|
def test_signup__raises_delivery_errors
|
|
79
|
-
|
|
80
|
-
post_signup :login => "newtesla",
|
|
81
|
-
:password => "newpassword", :password_confirmation => "newpassword",
|
|
82
|
-
:email => "newtesla@example.com"
|
|
76
|
+
Mail::TestMailer.inject_one_error = true
|
|
77
|
+
post_signup :login => "newtesla", :password => "newpassword", :password_confirmation => "newpassword", :email => "newtesla@example.com"
|
|
83
78
|
assert_not_logged_in
|
|
84
79
|
assert_equal 0, ActionMailer::Base.deliveries.size
|
|
85
80
|
assert_contains "confirmation email not sent", flash[:notice]
|
|
@@ -150,8 +145,8 @@ class UserControllerTest < ActionController::TestCase
|
|
|
150
145
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
|
151
146
|
mail = ActionMailer::Base.deliveries[0]
|
|
152
147
|
assert_equal "tesla@example.com", mail.to_addrs[0].to_s
|
|
153
|
-
assert_match /login:\s+\w+\n/, mail.encoded
|
|
154
|
-
assert_match /password:\s+\w+\n/, mail.encoded
|
|
148
|
+
assert_match /login:\s+\w+\s*\n/, mail.encoded
|
|
149
|
+
assert_match /password:\s+\w+\s*\n/, mail.encoded
|
|
155
150
|
assert_equal user, User.authenticate(user.login, 'changed_password')
|
|
156
151
|
end
|
|
157
152
|
|
|
@@ -165,9 +160,9 @@ class UserControllerTest < ActionController::TestCase
|
|
|
165
160
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
|
166
161
|
end
|
|
167
162
|
|
|
168
|
-
def
|
|
163
|
+
def test_change_password_succeeds_despite_delivery_errors
|
|
169
164
|
set_logged_in users(:tesla)
|
|
170
|
-
|
|
165
|
+
Mail::TestMailer.inject_one_error = true
|
|
171
166
|
post :change_password, :user => { :password => "changed_password", :password_confirmation => "changed_password" }
|
|
172
167
|
assert_equal 0, ActionMailer::Base.deliveries.size
|
|
173
168
|
assert_equal users(:tesla), User.authenticate(users(:tesla).login, 'changed_password')
|
|
@@ -194,7 +189,7 @@ class UserControllerTest < ActionController::TestCase
|
|
|
194
189
|
end
|
|
195
190
|
|
|
196
191
|
def test_forgot_password__reports_delivery_error
|
|
197
|
-
|
|
192
|
+
Mail::TestMailer.inject_one_error = true
|
|
198
193
|
post :forgot_password, :user => { :email => users(:tesla).email }
|
|
199
194
|
assert_equal 0, ActionMailer::Base.deliveries.size
|
|
200
195
|
assert_match /Your password could not be emailed/, @response.body
|
|
@@ -229,7 +224,7 @@ class UserControllerTest < ActionController::TestCase
|
|
|
229
224
|
end
|
|
230
225
|
|
|
231
226
|
def test_autologin_with_username_and_blank_password
|
|
232
|
-
@request.cookies['autologin'] =
|
|
227
|
+
@request.cookies['autologin'] = {:value => ['no_password_user'], :expires =>30.days.from_now}
|
|
233
228
|
get :welcome
|
|
234
229
|
assert_logged_in users(:no_password_user)
|
|
235
230
|
assert_response :redirect
|
|
@@ -237,8 +232,8 @@ class UserControllerTest < ActionController::TestCase
|
|
|
237
232
|
end
|
|
238
233
|
|
|
239
234
|
def test_autologin_with_token
|
|
240
|
-
@request.cookies['autologin'] =
|
|
241
|
-
@request.cookies['token'] =
|
|
235
|
+
@request.cookies['autologin'] = {:value => ['1000007'], :expires =>30.days.from_now}
|
|
236
|
+
@request.cookies['token'] = {:value => ['random_token_string'], :expires =>30.days.from_now}
|
|
242
237
|
get :welcome
|
|
243
238
|
assert_logged_in users(:no_password_user)
|
|
244
239
|
assert_response :redirect
|
|
@@ -246,8 +241,8 @@ class UserControllerTest < ActionController::TestCase
|
|
|
246
241
|
end
|
|
247
242
|
|
|
248
243
|
def test_autologin_unverified_user_with_token
|
|
249
|
-
@request.cookies['autologin'] =
|
|
250
|
-
@request.cookies['token'] =
|
|
244
|
+
@request.cookies['autologin'] = {:value => ['1000007'], :expires => 30.days.from_now}
|
|
245
|
+
@request.cookies['token'] = {:value => ['random_token_string'], :expires => 30.days.from_now}
|
|
251
246
|
get :welcome
|
|
252
247
|
assert_logged_in users(:no_password_user)
|
|
253
248
|
assert current_user.verified?
|
|
@@ -26,10 +26,11 @@ class WelcomeControllerTest < ActionController::TestCase
|
|
|
26
26
|
Estimate.delete_all
|
|
27
27
|
TaskFile.delete_all
|
|
28
28
|
Task.delete_all
|
|
29
|
-
|
|
29
|
+
ActiveRecord::Base.connection.execute("DELETE FROM work_lock_subscriptions")
|
|
30
|
+
Project.delete_all
|
|
30
31
|
get :index
|
|
31
32
|
assert_response :redirect
|
|
32
|
-
assert_redirected_to :controller => '
|
|
33
|
+
assert_redirected_to :controller => 'projects', :action => :new
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
def test_index_active_period
|
|
@@ -55,7 +56,7 @@ class WelcomeControllerTest < ActionController::TestCase
|
|
|
55
56
|
tasks(:in_ancient).finish(Task::COMPLETED, true)
|
|
56
57
|
get :index
|
|
57
58
|
assert_response :redirect
|
|
58
|
-
assert_redirected_to :controller => '
|
|
59
|
+
assert_redirected_to :controller => 'projects', :action => :show, :id => 1
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
end
|
|
@@ -78,7 +78,7 @@ class WorksControllerTest < ActionController::TestCase
|
|
|
78
78
|
def test_create
|
|
79
79
|
num_works = Work.count
|
|
80
80
|
|
|
81
|
-
post :create, :work => {:task_id => '1', :started_on => Date.today.to_s, :start_time => Time.now.time_of_day.to_s, :
|
|
81
|
+
post :create, :work => {:task_id => '1', :started_on => Date.today.to_s, :start_time => Time.now.time_of_day.to_s, :project_id => '1'}
|
|
82
82
|
|
|
83
83
|
assert_response :redirect
|
|
84
84
|
assert_redirected_to :controller => 'periods', :action => 'show', :id => periods(:past).id, :task_id => 1
|
|
@@ -89,7 +89,7 @@ class WorksControllerTest < ActionController::TestCase
|
|
|
89
89
|
def test_create_without_start_date
|
|
90
90
|
num_works = Work.count
|
|
91
91
|
|
|
92
|
-
post :create, :work => {:task_id => '1', :start_time => Time.now.time_of_day.to_s, :
|
|
92
|
+
post :create, :work => {:task_id => '1', :start_time => Time.now.time_of_day.to_s, :project_id => '1'}
|
|
93
93
|
|
|
94
94
|
assert_response :redirect
|
|
95
95
|
assert_redirected_to :controller => 'periods', :action => 'show', :id => periods(:past).id, :task_id => 1
|
|
@@ -100,7 +100,7 @@ class WorksControllerTest < ActionController::TestCase
|
|
|
100
100
|
def test_create_with_old_start_date
|
|
101
101
|
num_works = Work.count
|
|
102
102
|
|
|
103
|
-
post :create, :work => {:task_id => '1', :started_on => '2007-07-31', :
|
|
103
|
+
post :create, :work => {:task_id => '1', :started_on => '2007-07-31', :project_id => '1',
|
|
104
104
|
:start_time => '12:00', :completed_at => '2007-07-31 12:20'}
|
|
105
105
|
|
|
106
106
|
assert_response :redirect
|
|
@@ -113,7 +113,7 @@ class WorksControllerTest < ActionController::TestCase
|
|
|
113
113
|
def test_create_with_old_start_date_and_completed_at_time
|
|
114
114
|
num_works = Work.count
|
|
115
115
|
|
|
116
|
-
post :create, :work => {:task_id => '1', :started_on => '2007-07-31', :
|
|
116
|
+
post :create, :work => {:task_id => '1', :started_on => '2007-07-31', :project_id => '1',
|
|
117
117
|
:start_time => '12:00', :completed_at_time => '12:20'}
|
|
118
118
|
|
|
119
119
|
assert_response :redirect
|
|
@@ -127,7 +127,7 @@ class WorksControllerTest < ActionController::TestCase
|
|
|
127
127
|
def test_create_with_old_start_date_and_no_times
|
|
128
128
|
num_works = Work.count
|
|
129
129
|
|
|
130
|
-
post :create, :work => {:started_on => '2007-07-31', :
|
|
130
|
+
post :create, :work => {:started_on => '2007-07-31', :project_id => '1', :hours_time => '3:00'}
|
|
131
131
|
|
|
132
132
|
assert_response :redirect, assigns(:work).errors.to_a.inspect
|
|
133
133
|
assert_redirected_to :controller => 'works', :action => 'daily_work_sheet', :id => '2007-07-31'
|
data/test/mocks/test/clock.rb
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
|
2
|
+
require 'rails/performance_test_help'
|
|
3
|
+
|
|
4
|
+
# Profiling results for each test method are written to tmp/performance.
|
|
5
|
+
class BrowsingTest < ActionDispatch::PerformanceTest
|
|
6
|
+
def test_homepage
|
|
7
|
+
get '/'
|
|
8
|
+
end
|
|
9
|
+
end
|
data/test/performance/common.rb
CHANGED
data/test/test_helper.rb
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
ENV["RAILS_ENV"] = "test"
|
|
2
|
-
require File.expand_path(
|
|
3
|
-
require 'test_help'
|
|
4
|
-
|
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
|
3
|
+
require 'rails/test_help'
|
|
4
|
+
|
|
5
|
+
# ActiveSupport::Dependencies.autoload_paths.unshift Rails.root.to_s + '/test/mocks/test'
|
|
5
6
|
|
|
6
7
|
class ActiveSupport::TestCase
|
|
7
8
|
def self.main_scenario
|
|
8
|
-
fixtures :parties, :users, :groups, :groups_users, :
|
|
9
|
+
fixtures :parties, :users, :groups, :groups_users, :projects, :periods, :tasks,
|
|
9
10
|
:task_files, :works, :estimates, :work_lock_subscriptions, :work_locks, :absences
|
|
10
11
|
end
|
|
11
12
|
|
|
@@ -37,7 +38,7 @@ class ActiveSupport::TestCase
|
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
def assert_sequences
|
|
40
|
-
|
|
41
|
+
Project.find(:all).each do |b|
|
|
41
42
|
b.unplanned_tasks.each_with_index do |t, i|
|
|
42
43
|
assert_equal i+1, t.position
|
|
43
44
|
end
|
|
@@ -81,7 +82,7 @@ class ActiveSupport::TestCase
|
|
|
81
82
|
end
|
|
82
83
|
|
|
83
84
|
def assert_redirected_to_login
|
|
84
|
-
assert_equal @controller.url_for(:action => "login"),
|
|
85
|
+
assert_equal @controller.url_for(:action => "login"), response.redirect_url
|
|
85
86
|
end
|
|
86
87
|
|
|
87
88
|
def post_signup( user_params )
|
|
@@ -102,3 +103,19 @@ class ActiveSupport::TestCase
|
|
|
102
103
|
end
|
|
103
104
|
|
|
104
105
|
end
|
|
106
|
+
|
|
107
|
+
module Mail
|
|
108
|
+
class TestMailer
|
|
109
|
+
@@inject_one_error = false
|
|
110
|
+
cattr_accessor :inject_one_error
|
|
111
|
+
|
|
112
|
+
def deliver_with_exception!(mail)
|
|
113
|
+
if inject_one_error
|
|
114
|
+
Mail::TestMailer::inject_one_error = false
|
|
115
|
+
raise "Failed to send email" if raise_delivery_errors
|
|
116
|
+
end
|
|
117
|
+
deliver_without_exception!(mail)
|
|
118
|
+
end
|
|
119
|
+
alias_method_chain :deliver!, :exception
|
|
120
|
+
end
|
|
121
|
+
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
|
3
|
+
require 'rails/test_help'
|
|
4
|
+
|
|
5
|
+
ActiveSupport::Dependencies.autoload_paths.unshift Rails.root.to_s + '/test/mocks/test'
|
|
6
|
+
|
|
7
|
+
class ActiveSupport::TestCase
|
|
8
|
+
def self.main_scenario
|
|
9
|
+
fixtures :parties, :users, :groups, :groups_users, :projects, :periods, :tasks,
|
|
10
|
+
:task_files, :works, :estimates, :work_lock_subscriptions, :work_locks, :absences
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
|
14
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
|
15
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
|
16
|
+
# between every test method. Fewer database queries means faster tests.
|
|
17
|
+
#
|
|
18
|
+
# Read Mike Clark's excellent walkthrough at
|
|
19
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
|
20
|
+
#
|
|
21
|
+
# Every Active Record database supports transactions except MyISAM tables
|
|
22
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
|
23
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
|
24
|
+
# is recommended.
|
|
25
|
+
self.use_transactional_fixtures = true
|
|
26
|
+
|
|
27
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
|
28
|
+
# would need people(:david). If you don't want to migrate your existing
|
|
29
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
|
30
|
+
# instantiated fixtures translates to a database query per test method),
|
|
31
|
+
# then set this back to true.
|
|
32
|
+
self.use_instantiated_fixtures = false
|
|
33
|
+
|
|
34
|
+
# Add more helper methods to be used by all tests here...
|
|
35
|
+
|
|
36
|
+
def add_stored_detour
|
|
37
|
+
@request.session[:detours] = [{:controller => 'bogus', :action => :location}]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def assert_sequences
|
|
41
|
+
Project.find(:all).each do |b|
|
|
42
|
+
b.unplanned_tasks.each_with_index do |t, i|
|
|
43
|
+
assert_equal i+1, t.position
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
Party.find(:all).each do |p|
|
|
48
|
+
p.periods.each_with_index do |period, i|
|
|
49
|
+
assert_equal i+1, period.position
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
Period.find(:all).each do |p|
|
|
54
|
+
p.open_tasks.each_with_index do |t, i|
|
|
55
|
+
assert_equal i+1, t.position, "Open tasks for period #{p.id} are not in sequence:\n#{p.open_tasks.map{|t|[t.id, t.position]}.inspect}\nTask #{t.id} position does not match."
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# TODO (uwe): This method should be removed
|
|
61
|
+
# It is here only because ClassTableInheritanceInRails broke reading fixtures by name
|
|
62
|
+
def users(login)
|
|
63
|
+
User.find_by_login(login.to_s)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def set_logged_in( user )
|
|
67
|
+
@request.session[:user_id] = user.id
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def set_logged_out
|
|
71
|
+
@request.session[:user_id] = nil
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def assert_logged_in( user )
|
|
75
|
+
assert_equal user.id, @request.session[:user_id]
|
|
76
|
+
assert_equal user, Thread.current[:user]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def assert_not_logged_in
|
|
80
|
+
assert_nil @request.session[:user_id]
|
|
81
|
+
assert_nil assigns(:current_user)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def assert_redirected_to_login
|
|
85
|
+
assert_equal @controller.url_for(:action => "login"), response.redirect_url
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def post_signup( user_params )
|
|
89
|
+
post :signup, "user" => user_params
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def assert_password_validation_fails
|
|
93
|
+
user = assigns(:user)
|
|
94
|
+
assert_equal 1, user.errors.size
|
|
95
|
+
assert_not_nil user.errors['password']
|
|
96
|
+
assert_response :success
|
|
97
|
+
assert_equal 0, ActionMailer::Base.deliveries.size
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def assert_contains( target, container )
|
|
101
|
+
assert !container.nil?, %Q( Failed to find "#{target}" in nil String )
|
|
102
|
+
assert container.include?(target)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
module Mail
|
|
108
|
+
class TestMailer
|
|
109
|
+
@@inject_one_error = false
|
|
110
|
+
cattr_accessor :inject_one_error
|
|
111
|
+
|
|
112
|
+
def deliver_with_exception!(mail)
|
|
113
|
+
if inject_one_error
|
|
114
|
+
Mail::TestMailer::inject_one_error = false
|
|
115
|
+
raise "Failed to send email" if raise_delivery_errors
|
|
116
|
+
end
|
|
117
|
+
deliver_without_exception!(mail)
|
|
118
|
+
end
|
|
119
|
+
alias_method_chain :deliver!, :exception
|
|
120
|
+
end
|
|
121
|
+
end
|