fix unit tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user