fix tests

This commit is contained in:
Albert Yi
2018-06-20 11:11:46 -07:00
parent d240fdde66
commit e551ff9b0c
3 changed files with 7 additions and 8 deletions

View File

@@ -40,7 +40,6 @@ class Post < ApplicationRecord
after_commit :remove_iqdb_async, :on => :destroy
after_commit :update_iqdb_async, :on => :create
after_commit :notify_pubsub
after_create {|rec| rec.uploader.increment!(:post_upload_count)}
belongs_to :updater, :class_name => "User", optional: true # this is handled in versions
belongs_to :approver, class_name: "User", optional: true

View File

@@ -1823,6 +1823,13 @@ class PostTest < ActiveSupport::TestCase
assert_equal(user2.id, post.uploader_id)
assert_equal(user2.name, post.uploader_name)
end
should "increment the uploaders post_upload_count" do
assert_difference(-> { CurrentUser.user.post_upload_count }) do
post = FactoryBot.create(:post, uploader: CurrentUser.user)
CurrentUser.user.reload
end
end
end
end

View File

@@ -29,13 +29,6 @@ class UploadTest < ActiveSupport::TestCase
assert_equal(["You have reached your upload limit for the day"], @upload.errors.full_messages)
end
end
should "increment the uploaders post_upload_count" do
assert_difference(-> { CurrentUser.user.post_upload_count }) do
FactoryBot.create(:source_upload)
CurrentUser.user.reload
end
end
end
end
end