Fix rename projects spec so it doesn't hang

This spec would hang due to the use of transactions, and would
incorrectly stub Thread.new.
This commit is contained in:
Yorick Peterse 2016-12-27 13:45:44 +01:00
parent 2f93259c6b
commit 123bc1d5eb
No known key found for this signature in database
GPG key ID: EDD30D2BEB691AC9

View file

@ -3,14 +3,16 @@
require 'spec_helper' require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20161221153951_rename_reserved_project_names.rb') require Rails.root.join('db', 'post_migrate', '20161221153951_rename_reserved_project_names.rb')
describe RenameReservedProjectNames do # This migration uses multiple threads, and thus different transactions. This
# means data created in this spec may not be visible to some threads. To work
# around this we use the TRUNCATE cleaning strategy.
describe RenameReservedProjectNames, truncate: true do
let(:migration) { described_class.new } let(:migration) { described_class.new }
let!(:project) { create(:project) } let!(:project) { create(:empty_project) }
before do before do
project.path = 'projects' project.path = 'projects'
project.save!(validate: false) project.save!(validate: false)
allow(Thread).to receive(:new).and_yield
end end
describe '#up' do describe '#up' do