mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-22 18:20:12 +01:00
fix failing tests
This commit is contained in:
parent
a5031f2069
commit
acab98d4c7
3 changed files with 11 additions and 19 deletions
|
|
@ -130,7 +130,7 @@ class Project < ActiveRecord::Base
|
||||||
def stalled?
|
def stalled?
|
||||||
# Stalled projects are active projects with no active next actions
|
# Stalled projects are active projects with no active next actions
|
||||||
return false if self.completed? || self.hidden?
|
return false if self.completed? || self.hidden?
|
||||||
return self.todos.deferred_or_blocked.empty? && self.todos.not_deferred_or_blocked.empty?
|
return self.todos.deferred_or_blocked.empty? && self.todos.active.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def shortened_name(length=40)
|
def shortened_name(length=40)
|
||||||
|
|
|
||||||
|
|
@ -66,18 +66,4 @@ class PreferencesControllerTest < ActionController::TestCase
|
||||||
assert_equal old_password_hash, updated_admin_user.password
|
assert_equal old_password_hash, updated_admin_user.password
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should be able to change authentication type" do
|
|
||||||
assert Tracks::Config.auth_schemes.include?("open_id"), "open_id should be a valid authentication scheme"
|
|
||||||
|
|
||||||
login_as :admin_user
|
|
||||||
|
|
||||||
post :update, {
|
|
||||||
:id => users(:admin_user).id,
|
|
||||||
:user => { :first_name => 'Jane', :last_name => 'Doe', :auth_type => "open_id", :open_id_url => "http://test"},
|
|
||||||
:prefs => { :date_format => "%m-%d-%Y", :week_starts => "0", :show_number_completed => "10", :show_completed_projects_in_sidebar => "false", :show_hidden_contexts_in_sidebar => "false", :staleness_starts => "14", :due_style => "1" }}
|
|
||||||
|
|
||||||
updated_admin_user = users(:admin_user).reload
|
|
||||||
assert_equal "open_id", updated_admin_user.auth_type
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -219,11 +219,17 @@ class ProjectTest < ActiveSupport::TestCase
|
||||||
def test_project_stalled
|
def test_project_stalled
|
||||||
p = users(:admin_user).projects.first
|
p = users(:admin_user).projects.first
|
||||||
|
|
||||||
|
p.hide!
|
||||||
|
assert !p.stalled?, "hidden projects are not stalled"
|
||||||
|
|
||||||
|
p.complete!
|
||||||
|
assert !p.stalled?, "completed projects are not stalled"
|
||||||
|
|
||||||
|
p.activate!
|
||||||
p.todos.each{|t| t.complete!}
|
p.todos.each{|t| t.complete!}
|
||||||
|
assert p.todos.active.empty?, "project should not have active todos"
|
||||||
assert p.todos.active.count == 0, "project should not have active todos"
|
assert p.todos.deferred_or_blocked.empty?, "there should not be deferred or blocked todos"
|
||||||
|
assert p.reload.stalled?, "project should be stalled"
|
||||||
assert p.stalled?, "project should be stalled"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue