tests: fix post and pool version tests helpers.

* Fix the pool version SQS service to always be mocked before every
  test. Before we had to manually set it up before every test dealing
  with pool versions.

* Fix it so that we reconnect to the post/pool version databases before
  every test. Before using $ARCHIVE_DATABASE_URL to set the database url
  failed because environment variables weren't loaded by dotenv yet when
  connections were first established.
This commit is contained in:
evazion
2020-03-21 15:00:35 -05:00
parent 3cb2c10be8
commit 94ae10b1a6
10 changed files with 79 additions and 123 deletions

View File

@@ -3,8 +3,6 @@ require 'test_helper'
class PoolElementsControllerTest < ActionDispatch::IntegrationTest
context "The pools posts controller" do
setup do
mock_pool_archive_service!
start_pool_archive_transaction
@user = travel_to(1.month.ago) {create(:user)}
@mod = create(:moderator_user)
as_user do
@@ -13,10 +11,6 @@ class PoolElementsControllerTest < ActionDispatch::IntegrationTest
end
end
teardown do
rollback_pool_archive_transaction
end
context "create action" do
should "add a post to a pool" do
post_auth pool_element_path, @user, params: {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}