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:
@@ -8,14 +8,9 @@ class PoolTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
|
||||
mock_pool_archive_service!
|
||||
PoolVersion.sqs_service.stubs(:merge?).returns(false)
|
||||
start_pool_archive_transaction
|
||||
end
|
||||
|
||||
teardown do
|
||||
rollback_pool_archive_transaction
|
||||
CurrentUser.user = nil
|
||||
CurrentUser.ip_addr = nil
|
||||
end
|
||||
|
||||
@@ -23,7 +23,6 @@ class PostTest < ActiveSupport::TestCase
|
||||
end
|
||||
CurrentUser.user = @user
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
mock_pool_archive_service!
|
||||
end
|
||||
|
||||
def teardown
|
||||
@@ -838,15 +837,6 @@ class PostTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
context "for a pool" do
|
||||
setup do
|
||||
mock_pool_archive_service!
|
||||
start_pool_archive_transaction
|
||||
end
|
||||
|
||||
teardown do
|
||||
rollback_pool_archive_transaction
|
||||
end
|
||||
|
||||
context "on creation" do
|
||||
setup do
|
||||
@pool = FactoryBot.create(:pool)
|
||||
@@ -1863,10 +1853,6 @@ class PostTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
context "Searching:" do
|
||||
setup do
|
||||
mock_pool_archive_service!
|
||||
end
|
||||
|
||||
should "return posts for the age:<1minute tag" do
|
||||
post = FactoryBot.create(:post)
|
||||
assert_tag_match([post], "age:<1minute")
|
||||
|
||||
Reference in New Issue
Block a user