updated tests, switched to rails 3.0.0rc2

This commit is contained in:
albert
2010-08-26 14:36:02 -04:00
parent 694b6f0813
commit ad39553aac
48 changed files with 898 additions and 406 deletions

View File

@@ -1,11 +1,19 @@
require File.dirname(__FILE__) + '/../test_helper'
require_relative '../test_helper'
class CommentTest < ActiveSupport::TestCase
context "A comment" do
setup do
user = Factory.create(:user)
CurrentUser.user = user
CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all
end
teardown do
CurrentUser.user = nil
CurrentUser.ip_addr = nil
end
should "be created" do
comment = Factory.build(:comment)
comment.save
@@ -37,12 +45,12 @@ class CommentTest < ActiveSupport::TestCase
user = Factory.create(:user)
post = Factory.create(:post)
c1 = Factory.create(:comment, :post => post)
assert_nothing_raised {c1.vote!(user, true)}
assert_raise(CommentVote::Error) {c1.vote!(user, true)}
assert_nothing_raised {c1.vote!(true)}
assert_raise(CommentVote::Error) {c1.vote!(true)}
assert_equal(1, CommentVote.count)
c2 = Factory.create(:comment, :post => post)
assert_nothing_raised {c2.vote!(user, true)}
assert_nothing_raised {c2.vote!(true)}
assert_equal(2, CommentVote.count)
end