Updated tests to pass even in the case of the weird schema (integer fields instead of booleans) that still pops up.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@479 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-03-20 05:06:37 +00:00
parent 1bf617f8f1
commit 11ed78abe2
7 changed files with 11 additions and 7 deletions

View file

@ -24,7 +24,7 @@ class Context < ActiveRecord::Base
end
def hidden?
self.hide == true
self.hide == true || self.hide == 1
end
def to_param

View file

@ -63,7 +63,7 @@ class ContextsControllerTest < TodoContainerControllerTestBase
%w(guid link).each do |node|
assert_select node, /http:\/\/test.host\/contexts\/.+/
end
assert_select 'pubDate', /(#{contexts(:agenda).created_at.to_s(:rfc822)}|#{contexts(:library).created_at.to_s(:rfc822)})/
assert_select 'pubDate', contexts(:agenda).created_at.to_s(:rfc822)
end
end
end

View file

@ -117,7 +117,7 @@ class ProjectsControllerTest < TodoContainerControllerTestBase
%w(guid link).each do |node|
assert_select node, /http:\/\/test.host\/projects\/.+/
end
assert_select 'pubDate', /(#{projects(:timemachine).updated_at.to_s(:rfc822)}|#{projects(:moremoney).updated_at.to_s(:rfc822)})/
assert_select 'pubDate', projects(:timemachine).updated_at.to_s(:rfc822)
end
end
end

View file

@ -124,7 +124,7 @@ class TodosControllerTest < Test::Unit::TestCase
assert_equal 3, @tagged
end
def test_rss_feed_content
def test_find_tagged_withd_content
@request.session['user_id'] = users(:admin_user).id
get :index, { :format => "rss" }
assert_equal 'application/rss+xml; charset=utf-8', @response.headers["Content-Type"]
@ -142,7 +142,7 @@ class TodosControllerTest < Test::Unit::TestCase
%w(guid link).each do |node|
assert_select node, /http:\/\/test.host\/contexts\/.+/
end
assert_select 'pubDate', /(#{projects(:timemachine).updated_at.to_s(:rfc822)}|#{projects(:moremoney).updated_at.to_s(:rfc822)})/
assert_select 'pubDate', projects(:timemachine).updated_at.to_s(:rfc822)
end
end
end

View file

@ -60,7 +60,7 @@ class ContextXmlApiTest < ActionController::IntegrationTest
assert_response 200
assert_xml_select 'context' do
assert_select 'created-at', /\d{4}+-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/
assert_select 'hide', 'false'
assert_select 'hide', /false|0/ #TODO: Figure out schema issues
assert_select 'id', /\d+/
assert_select 'name', @@context_name
assert_select 'position', '3'

View file

@ -122,13 +122,16 @@ class ContextTest < Test::Unit::TestCase
def test_hidden_attr_reader
assert !@agenda.hidden?
@agenda.hide = true
assert @agenda.hidden?
@agenda.save!
@agenda.reload
assert_equal true, @agenda.hidden?
end
def test_summary
undone_todo_count = '5 actions'
assert_equal "<p>#{undone_todo_count}. Context is Active.</p>", @agenda.summary(undone_todo_count)
@agenda.hide = true
@agenda.save!
assert_equal "<p>#{undone_todo_count}. Context is Hidden.</p>", @agenda.summary(undone_todo_count)
end

View file

@ -130,6 +130,7 @@ class TodoTest < Test::Unit::TestCase
def test_initial_state_is_deferred_when_show_from_in_future
t = Todo.new
t.user = users(:admin_user)
t.description = 'foo'
t.context_id = 1
t.show_from = 1.week.from_now.to_date