Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Mountney <david@twkie.net>2018-06-27 23:42:22 +0300
committerDJ Mountney <david@twkie.net>2018-06-27 23:42:22 +0300
commit1ef3b3efbddd6c4a81102acf940674d80e0c0a8d (patch)
treef185662cb1be250db5b6e8534868b578e190f181 /spec/tasks
parenta9fcf968566a63cc5af70789e9b7e558c68585c2 (diff)
Update tests for gitlab:db:configure
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/db_rake_spec.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb
index fc52c04e78d..81b9ac94ff3 100644
--- a/spec/tasks/gitlab/db_rake_spec.rb
+++ b/spec/tasks/gitlab/db_rake_spec.rb
@@ -20,7 +20,7 @@ describe 'gitlab:db namespace rake task' do
describe 'configure' do
it 'invokes db:migrate when schema has already been loaded' do
- allow(ActiveRecord::Base.connection).to receive(:tables).and_return(['default'])
+ allow(ActiveRecord::Base.connection).to receive(:tables).and_return(['table1', 'table2'])
expect(Rake::Task['db:migrate']).to receive(:invoke)
expect(Rake::Task['db:schema:load']).not_to receive(:invoke)
expect(Rake::Task['db:seed_fu']).not_to receive(:invoke)
@@ -35,6 +35,14 @@ describe 'gitlab:db namespace rake task' do
expect { run_rake_task('gitlab:db:configure') }.not_to raise_error
end
+ it 'invokes db:shema:load and db:seed_fu when there is only a single table present' do
+ allow(ActiveRecord::Base.connection).to receive(:tables).and_return(['default'])
+ expect(Rake::Task['db:schema:load']).to receive(:invoke)
+ expect(Rake::Task['db:seed_fu']).to receive(:invoke)
+ expect(Rake::Task['db:migrate']).not_to receive(:invoke)
+ expect { run_rake_task('gitlab:db:configure') }.not_to raise_error
+ end
+
it 'does not invoke any other rake tasks during an error' do
allow(ActiveRecord::Base).to receive(:connection).and_raise(RuntimeError, 'error')
expect(Rake::Task['db:migrate']).not_to receive(:invoke)