fixed unit tests

This commit is contained in:
albert
2012-01-15 14:40:36 -05:00
parent 69f76a1a41
commit 0887c35922
3 changed files with 7 additions and 6 deletions

View File

@@ -50,8 +50,9 @@ class DmailTest < ActiveSupport::TestCase
end
should "create a copy for each user" do
@new_user = Factory.create(:user)
assert_difference("Dmail.count", 2) do
Dmail.create_split(:to_id => @user.id, :title => "foo", :body => "foo")
Dmail.create_split(:to_id => @new_user.id, :title => "foo", :body => "foo")
end
end

View File

@@ -84,7 +84,7 @@ class DTextTest < ActiveSupport::TestCase
end
def test_complex_links
assert_equal('<p><a href="/wiki_pages/show_or_new?title=2+3">1</a> | <a href="/wiki_pages/show_or_new?title=5+6">4</a></p>', p("[[1|2 3]] | [[4|5 6]]"))
assert_equal("<p>Tags <strong>(<a href=\"/wiki_pages/show_or_new?title=Tagging+Guidelines\">howto:tag</a> | <a href=\"/wiki_pages/show_or_new?title=Tag+Checklist\">howto:tag checklist</a> | <a href=\"/wiki_pages/show_or_new?title=Tag+Groups\">Tag Groups</a>)</strong></p>", p("Tags [b]([[howto:tag|Tagging Guidelines]] | [[howto:tag_checklist|Tag Checklist]] | [[Tag Groups]])[/b]"))
assert_equal("<p><a href=\"/wiki_pages/show_or_new?title=1\">2 3</a> | <a href=\"/wiki_pages/show_or_new?title=4\">5 6</a></p>", p("[[1|2 3]] | [[4|5 6]]"))
assert_equal("<p>Tags <strong>(<a href=\"/wiki_pages/show_or_new?title=howto%3Atag\">Tagging Guidelines</a> | <a href=\"/wiki_pages/show_or_new?title=howto%3Atag_checklist\">Tag Checklist</a> | <a href=\"/wiki_pages/show_or_new?title=Tag+Groups\">Tag Groups</a>)</strong></p>", p("Tags [b]([[howto:tag|Tagging Guidelines]] | [[howto:tag_checklist|Tag Checklist]] | [[Tag Groups]])[/b]"))
end
end

View File

@@ -18,17 +18,17 @@ module Moderator
end
should "find by ip addr" do
@search = IpAddrSearch.new(:ip_addr => "127.0.0.1")
@search = IpAddrSearch.new(:ip_addr_eq => "127.0.0.1")
assert_equal({@user.id.to_s => 2}, @search.execute)
end
should "find by user id" do
@search = IpAddrSearch.new(:user_id => @user.id.to_s)
@search = IpAddrSearch.new(:user_id_eq => @user.id.to_s)
assert_equal({"127.0.0.1" => 2}, @search.execute)
end
should "find by user name" do
@search = IpAddrSearch.new(:user_name => @user.name)
@search = IpAddrSearch.new(:user_name_eq => @user.name)
assert_equal({"127.0.0.1" => 2}, @search.execute)
end
end