fix unit tests

This commit is contained in:
r888888888
2015-09-23 12:13:14 -07:00
parent b6d9011f6c
commit 3df9f0cdf6
9 changed files with 14045 additions and 93 deletions

View File

@@ -53,7 +53,9 @@ class PostDisapprovalTest < ActiveSupport::TestCase
setup do
@post = FactoryGirl.create(:post)
@user = FactoryGirl.create(:user)
@disapproval = PostDisapproval.create(:user => @user, :post => @post)
Timecop.travel(2.months.ago) do
@disapproval = PostDisapproval.create(:user => @user, :post => @post)
end
end
should "be pruned" do

View File

@@ -33,7 +33,7 @@ module Sources
end
should "get the artist name" do
assert_equal("The Noun Project", @site.artist_name)
assert_equal("Noun Project", @site.artist_name)
end
should "get the image url" do

View File

@@ -36,7 +36,7 @@ class UploadTest < ActiveSupport::TestCase
should "fail creation" do
@upload = FactoryGirl.build(:jpg_upload, :tag_string => "")
@upload.save
assert_equal(["You can not upload until your pending posts have been approved"], @upload.errors.full_messages)
assert_equal(["You have reached your upload limit for the day"], @upload.errors.full_messages)
end
end

View File

@@ -91,16 +91,18 @@ class UserTest < ActiveSupport::TestCase
@user.update_column(:level, User::Levels::CONTRIBUTOR)
assert(@user.can_upload?)
@user.update_column(:level, User::Levels::MEMBER)
@user.update_column(:created_at, 1.month.ago)
@user.update_column(:created_at, 15.days.ago)
assert_equal(10, @user.upload_limit)
9.times do
FactoryGirl.create(:post, :uploader => @user, :is_pending => true)
end
@user = User.find(@user.id)
assert_equal(1, @user.upload_limit)
assert(@user.can_upload?)
FactoryGirl.create(:post, :uploader => @user, :is_pending => true)
@user = User.find(@user.id)
assert(!@user.can_upload?)
end