several fixes to recurring todos and adds some named_scopes

fixes case where unmarking a complete todo which belongs to a recurring pattern results in two todos that both keep on recurring. With this fix a new todo will only be created when there are no active todos left belonging to that recurring pattern

fixes tests that failed because of previous commits

adds some named_scopes, inspired by http://railscasts.com/episodes/108
This commit is contained in:
Reinier Balt 2008-11-28 16:39:50 +01:00
parent bd2b410c7b
commit 4a98ee5669
8 changed files with 55 additions and 31 deletions

View file

@ -95,7 +95,7 @@ end
completed_at: ~
user_id: 1
7:
book:
id: 7
context_id: 6
project_id: 3

View file

@ -223,9 +223,9 @@ class ProjectsControllerTest < TodoContainerControllerTestBase
login_as :admin_user
u = users(:admin_user)
post :actionize, :state => "active", :format => 'js'
assert_equal 1, projects(:gardenclean).position
assert_equal 2, projects(:timemachine).position
assert_equal 3, projects(:moremoney).position
assert_equal 1, projects(:gardenclean).position
assert_equal 2, projects(:moremoney).position
assert_equal 3, projects(:timemachine).position
end
def test_alphabetize_sorts_active_projects_alphabetically

View file

@ -180,7 +180,7 @@ class TodosControllerTest < Test::Rails::TestCase
login_as(:admin_user)
get :index, { :format => "rss" }
assert_equal 'application/rss+xml', @response.content_type
# #puts @response.body
# puts @response.body
assert_xml_select 'rss[version="2.0"]' do
assert_select 'channel' do
@ -193,7 +193,7 @@ class TodosControllerTest < Test::Rails::TestCase
assert_select 'description', /.*/
assert_select 'link', %r{http://test.host/contexts/.+}
assert_select 'guid', %r{http://test.host/todos/.+}
assert_select 'pubDate', projects(:timemachine).updated_at.to_s(:rfc822)
assert_select 'pubDate', todos(:book).updated_at.to_s(:rfc822)
end
end
end
@ -245,7 +245,7 @@ class TodosControllerTest < Test::Rails::TestCase
assert_xml_select 'entry', 11 do
assert_xml_select 'title', /.+/
assert_xml_select 'content[type="html"]', /.*/
assert_xml_select 'published', /(#{Regexp.escape(projects(:timemachine).updated_at.xmlschema)}|#{Regexp.escape(projects(:moremoney).updated_at.xmlschema)})/
assert_xml_select 'published', /(#{Regexp.escape(todos(:book).updated_at.xmlschema)}|#{Regexp.escape(projects(:moremoney).updated_at.xmlschema)})/
end
end
end