fix tests
This commit is contained in:
@@ -40,7 +40,6 @@ class Post < ApplicationRecord
|
|||||||
after_commit :remove_iqdb_async, :on => :destroy
|
after_commit :remove_iqdb_async, :on => :destroy
|
||||||
after_commit :update_iqdb_async, :on => :create
|
after_commit :update_iqdb_async, :on => :create
|
||||||
after_commit :notify_pubsub
|
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 :updater, :class_name => "User", optional: true # this is handled in versions
|
||||||
belongs_to :approver, class_name: "User", optional: true
|
belongs_to :approver, class_name: "User", optional: true
|
||||||
|
|||||||
@@ -1823,6 +1823,13 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
assert_equal(user2.id, post.uploader_id)
|
assert_equal(user2.id, post.uploader_id)
|
||||||
assert_equal(user2.name, post.uploader_name)
|
assert_equal(user2.name, post.uploader_name)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,6 @@ class UploadTest < ActiveSupport::TestCase
|
|||||||
assert_equal(["You have reached your upload limit for the day"], @upload.errors.full_messages)
|
assert_equal(["You have reached your upload limit for the day"], @upload.errors.full_messages)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user