Commit 123bc1d5 authored by Yorick Peterse's avatar Yorick Peterse

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.
parent 2f93259c
...@@ -3,14 +3,16 @@ ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment