This commit is contained in:
albert
2013-03-06 20:13:55 -05:00
parent 1582a6135b
commit dba5fd23e1
2 changed files with 23 additions and 0 deletions

View File

@@ -16,6 +16,19 @@ class DmailTest < ActiveSupport::TestCase
CurrentUser.user = nil
end
context "from a banned user" do
setup do
@user.update_attribute(:is_banned, true)
end
should "not validate" do
dmail = FactoryGirl.build(:dmail, :title => "xxx", :owner => @user)
dmail.save
assert_equal(1, dmail.errors.size)
assert_equal(["Sender is banned and cannot send messages"], dmail.errors.full_messages)
end
end
context "search" do
should "return results based on title contents" do
dmail = FactoryGirl.create(:dmail, :title => "xxx", :owner => @user)