mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 09:18:50 +01:00
fix failing tests
Includes a monkey patch for Arel that may need to be removed when 4.0.0 final ships
This commit is contained in:
parent
80974fb0d5
commit
08498fee4f
10 changed files with 50 additions and 43 deletions
|
|
@ -1,19 +1,10 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
||||
require 'data_controller'
|
||||
|
||||
# Re-raise errors caught by the controller.
|
||||
class DataController; def rescue_action(e) raise e end; end
|
||||
|
||||
class DataControllerTest < ActionController::TestCase
|
||||
fixtures :users, :preferences, :projects, :notes
|
||||
|
||||
def setup
|
||||
@controller = DataController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
|
||||
# Replace this with your real tests.
|
||||
def test_csv_export_completes_without_error
|
||||
login_as :admin_user
|
||||
get :csv_notes
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
|||
"yearly_month_of_year"=>"6",
|
||||
"yearly_selector"=>"yearly_every_x_day"
|
||||
},
|
||||
"tag_list"=>"one, two, three, four"
|
||||
"tag_list"=>"one, two, three, four", :format => :js
|
||||
|
||||
# check new recurring todo added
|
||||
assert_equal orig_rt_count+1, RecurringTodo.count
|
||||
|
|
@ -156,7 +156,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
|||
"recurring_show_days_before"=>"0",
|
||||
"recurring_target"=>"due_date",
|
||||
"recurring_show_always" => "1",
|
||||
"start_from"=>"1/10/2012", # adjust after 2012
|
||||
"start_from"=>"1/10/2012",
|
||||
"weekly_every_x_week"=>"1",
|
||||
"weekly_return_monday"=>"w",
|
||||
"yearly_day_of_week"=>"0",
|
||||
|
|
@ -166,7 +166,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
|||
"yearly_month_of_year"=>"10",
|
||||
"yearly_selector"=>"yearly_every_xth_day"
|
||||
},
|
||||
"tag_list"=>"one, two, three, four"
|
||||
"tag_list"=>"one, two, three, four", :format => :js
|
||||
|
||||
# check new recurring todo added
|
||||
assert_equal orig_rt_count+1, RecurringTodo.count
|
||||
|
|
@ -220,7 +220,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
|||
"yearly_month_of_year"=>"10",
|
||||
"yearly_selector"=>"yearly_every_xth_day"
|
||||
},
|
||||
"tag_list"=>"one, two, three, four"
|
||||
"tag_list"=>"one, two, three, four", :format => :js
|
||||
|
||||
# check new recurring todo added
|
||||
assert_equal orig_rt_count+1, RecurringTodo.count
|
||||
|
|
|
|||
|
|
@ -621,11 +621,11 @@ class TodosControllerTest < ActionController::TestCase
|
|||
assert todo_1.completed?
|
||||
|
||||
# check that there is only one active todo belonging to recurring_todo
|
||||
count = Todo.count(:all, :conditions => {:recurring_todo_id => recurring_todo_1.id, :state => 'active'})
|
||||
count = Todo.where(:recurring_todo_id => recurring_todo_1.id, :state => 'active').count
|
||||
assert_equal 1, count
|
||||
|
||||
# check there is a new todo linked to the recurring pattern
|
||||
next_todo = Todo.find(:first, :conditions => {:recurring_todo_id => recurring_todo_1.id, :state => 'active'})
|
||||
next_todo = Todo.where(:recurring_todo_id => recurring_todo_1.id, :state => 'active').first
|
||||
assert_equal "Call Bill Gates every day", next_todo.description
|
||||
# check that the new todo is not the same as todo_1
|
||||
assert_not_equal todo_1.id, next_todo.id
|
||||
|
|
@ -651,11 +651,11 @@ class TodosControllerTest < ActionController::TestCase
|
|||
|
||||
# check that there are three todos belonging to recurring_todo: two
|
||||
# completed and one deferred
|
||||
count = Todo.count(:all, :conditions => {:recurring_todo_id => recurring_todo_1.id})
|
||||
count = Todo.where(:recurring_todo_id => recurring_todo_1.id).count
|
||||
assert_equal 3, count
|
||||
|
||||
# check there is a new todo linked to the recurring pattern in the tickler
|
||||
next_todo = Todo.find(:first, :conditions => {:recurring_todo_id => recurring_todo_1.id, :state => 'deferred'})
|
||||
next_todo = Todo.where(:recurring_todo_id => recurring_todo_1.id, :state => 'deferred').first
|
||||
assert !next_todo.nil?
|
||||
assert_equal "Call Bill Gates every day", next_todo.description
|
||||
# check that the todo is in the tickler
|
||||
|
|
@ -825,7 +825,7 @@ class TodosControllerTest < ActionController::TestCase
|
|||
assert_equal 0, successor.predecessors.size
|
||||
|
||||
# add predecessor
|
||||
put :add_predecessor, :predecessor=>predecessor.id, :successor=>successor.id
|
||||
put :add_predecessor, :predecessor=>predecessor.id, :successor=>successor.id, :format => "js"
|
||||
|
||||
assert_equal 1, successor.predecessors.count
|
||||
assert_equal predecessor.id, successor.predecessors.first.id
|
||||
|
|
@ -839,10 +839,10 @@ class TodosControllerTest < ActionController::TestCase
|
|||
other_todo = todos(:phone_grandfather)
|
||||
|
||||
# predecessor -> successor
|
||||
put :add_predecessor, :predecessor=>predecessor.id, :successor=>successor.id
|
||||
put :add_predecessor, :predecessor=>predecessor.id, :successor=>successor.id, :format => "js"
|
||||
|
||||
# other_todo -> predecessor -> successor
|
||||
put :add_predecessor, :predecessor=>other_todo.id, :successor=>predecessor.id
|
||||
put :add_predecessor, :predecessor=>other_todo.id, :successor=>predecessor.id, :format => "js"
|
||||
|
||||
assert_equal 1, successor.predecessors(true).count
|
||||
assert_equal 0, other_todo.predecessors(true).count
|
||||
|
|
@ -861,12 +861,12 @@ class TodosControllerTest < ActionController::TestCase
|
|||
t4 = todos(:construct_dilation_device)
|
||||
|
||||
# t1 -> t2
|
||||
put :add_predecessor, :predecessor=>t1.id, :successor=>t2.id
|
||||
put :add_predecessor, :predecessor=>t1.id, :successor=>t2.id, :format => "js"
|
||||
# t3 -> t4
|
||||
put :add_predecessor, :predecessor=>t3.id, :successor=>t4.id
|
||||
put :add_predecessor, :predecessor=>t3.id, :successor=>t4.id, :format => "js"
|
||||
|
||||
# t2 -> t4
|
||||
put :add_predecessor, :predecessor=>t2.id, :successor=>t4.id
|
||||
put :add_predecessor, :predecessor=>t2.id, :successor=>t4.id, :format => "js"
|
||||
|
||||
# should be: t1 -> t2 -> t4 and t3 -> t4
|
||||
assert t4.predecessors.map(&:id).include?(t2.id)
|
||||
|
|
@ -884,12 +884,12 @@ class TodosControllerTest < ActionController::TestCase
|
|||
t4 = todos(:construct_dilation_device)
|
||||
|
||||
# t1 -> t2
|
||||
put :add_predecessor, :predecessor=>t1.id, :successor=>t2.id
|
||||
put :add_predecessor, :predecessor=>t1.id, :successor=>t2.id, :format => "js"
|
||||
# t3 -> t4
|
||||
put :add_predecessor, :predecessor=>t3.id, :successor=>t4.id
|
||||
put :add_predecessor, :predecessor=>t3.id, :successor=>t4.id, :format => "js"
|
||||
|
||||
# t3 -> t2
|
||||
put :add_predecessor, :predecessor=>t3.id, :successor=>t2.id
|
||||
put :add_predecessor, :predecessor=>t3.id, :successor=>t2.id, :format => "js"
|
||||
|
||||
# should be: t1 -> t2 and t3 -> t4 & t2
|
||||
assert t3.successors.map(&:id).include?(t4.id)
|
||||
|
|
@ -909,12 +909,12 @@ class TodosControllerTest < ActionController::TestCase
|
|||
|
||||
# create same dependency tree as previous test
|
||||
# should be: t1 -> t2 -> t4 and t3 -> t4
|
||||
put :add_predecessor, :predecessor=>t1.id, :successor=>t2.id
|
||||
put :add_predecessor, :predecessor=>t3.id, :successor=>t4.id
|
||||
put :add_predecessor, :predecessor=>t2.id, :successor=>t4.id
|
||||
put :add_predecessor, :predecessor=>t1.id, :successor=>t2.id, :format => "js"
|
||||
put :add_predecessor, :predecessor=>t3.id, :successor=>t4.id, :format => "js"
|
||||
put :add_predecessor, :predecessor=>t2.id, :successor=>t4.id, :format => "js"
|
||||
|
||||
# removing t4 as successor of t2 should leave t4 blocked with t3 as predecessor
|
||||
put :remove_predecessor, :predecessor=>t2.id, :id=>t4.id
|
||||
put :remove_predecessor, :predecessor=>t2.id, :id=>t4.id, :format => "js"
|
||||
|
||||
t4.reload
|
||||
assert t4.pending?, "t4 should remain pending"
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ class UsersControllerTest < ActionController::TestCase
|
|||
|
||||
def test_destroy_user
|
||||
login_as :admin_user
|
||||
@no_users_before = User.find(:all).size
|
||||
@no_users_before = User.count
|
||||
user_id = users(:ldap_user).id
|
||||
xhr :post, :destroy, :id => user_id.to_param
|
||||
assert_equal @no_users_before-1, User.find(:all).size
|
||||
assert_equal @no_users_before-1, User.count
|
||||
end
|
||||
|
||||
def test_update_password_successful
|
||||
|
|
@ -67,7 +67,7 @@ class UsersControllerTest < ActionController::TestCase
|
|||
login_as :admin_user
|
||||
post :update_password, :id => users(:admin_user).id, :user => {:password => 'newpassword', :password_confirmation => 'wrong'}
|
||||
assert_redirected_to change_password_user_path(users(:admin_user))
|
||||
assert_equal 'Validation failed: Password doesn\'t match confirmation', flash[:error]
|
||||
assert_equal 'Validation failed: Password confirmation doesn\'t match confirmation', flash[:error]
|
||||
end
|
||||
|
||||
def test_update_password_validation_errors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue