In commitf638e5017we introduced some methods to avoid race conditions in tests that created debates, proposals or investments. However, since we don't have a way to effectively make sure we use these methods in new code, we forgot to do so when adding tests in commitsc483c6036and84b88c0ec. So we're using them now. There's a chance that this is what was causing multitenancy tests to fail sometimes; if we don't wait for the request to get the suggestions to finish, the application might still be dealing with this request when we make another request to a different subdomain, or when the test has finished and the tenant has already been deleted. On my machine, the test "Creating content in one tenant doesn't affect other tenants" failed about 5% of the time without these changes, and I haven't been able to reproduce this failure after applying them. Having said that, it's possible that this is a coincidence and that this test will fail for a different reason in the future (like `login_as` not working properly with subdomains).
28 lines
1022 B
Ruby
28 lines
1022 B
Ruby
require "rails_helper"
|
|
|
|
describe "Documents" do
|
|
describe "Metadata" do
|
|
scenario "download document without metadata" do
|
|
login_as(create(:user))
|
|
visit new_proposal_path
|
|
|
|
fill_in_new_proposal_title with: "debate"
|
|
fill_in "Proposal summary", with: "In summary, what we want is..."
|
|
fill_in "Full name of the person submitting the proposal", with: "Isabel Garcia"
|
|
documentable_attach_new_file(file_fixture("logo_with_metadata.pdf"))
|
|
check "I agree to the Privacy Policy and the Terms and conditions of use"
|
|
|
|
click_button "Create proposal"
|
|
|
|
io = URI.parse("#{app_host}#{polymorphic_path(Document.last.attachment)}").open
|
|
reader = PDF::Reader.new(io)
|
|
|
|
expect(reader.info[:Keywords]).not_to eq "Test Metadata"
|
|
expect(reader.info[:Author]).not_to eq "Test Developer"
|
|
expect(reader.info[:Title]).not_to eq "logo_with_metadata.pdf"
|
|
expect(reader.info[:Producer]).not_to eq "Test Producer"
|
|
expect(reader.info).to eq({})
|
|
end
|
|
end
|
|
end
|