tests: fix unit tests.

* Move old post archive tests to post version tests.

* Fix pool tests that assumed that multiple edits by the same user
  weren't merged.

* Fix references to `is_active` and `notes` on artist model.
This commit is contained in:
evazion
2020-03-21 16:47:50 -05:00
parent 94ae10b1a6
commit 3656063a6b
16 changed files with 134 additions and 279 deletions

View File

@@ -100,22 +100,15 @@ class PoolsControllerTest < ActionDispatch::IntegrationTest
context "revert action" do
setup do
as_user do
@post_2 = create(:post)
@pool = create(:pool, post_ids: [@post.id])
end
CurrentUser.scoped(@user, "1.2.3.4") do
@pool.update(post_ids: [@post.id, @post_2.id])
end
@post_2 = as(@user) { create(:post) }
@pool = as(@user) { create(:pool, post_ids: [@post.id]) }
as(@mod) { @pool.update!(post_ids: [@post.id, @post_2.id]) }
end
should "revert to a previous version" do
@pool.reload
version = @pool.versions.first
assert_equal([@post.id], version.post_ids)
put_auth revert_pool_path(@pool), @mod, params: {:version_id => version.id}
@pool.reload
assert_equal([@post.id], @pool.post_ids)
put_auth revert_pool_path(@pool), @mod, params: { version_id: @pool.versions.first.id }
assert_redirected_to @pool
assert_equal([@post.id], @pool.reload.post_ids)
end
should "not allow reverting to a previous version of another pool" do