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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-17 21:09:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-17 21:09:00 +0300
commiteb1f5a3e087b7d6a3e85f2724b5a475cc9d9d37d (patch)
treed572a6d931152ae0dd10427237f5811893438552 /spec/lib/gitlab/current_settings_spec.rb
parentb304a72312465ed4c0a568ee6a6ea5e97f705c9b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/current_settings_spec.rb')
-rw-r--r--spec/lib/gitlab/current_settings_spec.rb40
1 files changed, 24 insertions, 16 deletions
diff --git a/spec/lib/gitlab/current_settings_spec.rb b/spec/lib/gitlab/current_settings_spec.rb
index eced96a4c77..adbd7eabd18 100644
--- a/spec/lib/gitlab/current_settings_spec.rb
+++ b/spec/lib/gitlab/current_settings_spec.rb
@@ -120,17 +120,13 @@ describe Gitlab::CurrentSettings do
end
context 'with pending migrations' do
+ let(:current_settings) { described_class.current_application_settings }
+
before do
- expect_any_instance_of(ActiveRecord::MigrationContext).to receive(:needs_migration?).and_return(true)
+ allow(Gitlab::Runtime).to receive(:rake?).and_return(false)
end
shared_examples 'a non-persisted ApplicationSetting object' do
- let(:current_settings) { described_class.current_application_settings }
-
- it 'returns a FakeApplicationSettings object' do
- expect(current_settings).to be_a(Gitlab::FakeApplicationSettings)
- end
-
it 'uses the default value from ApplicationSetting.defaults' do
expect(current_settings.signup_enabled).to eq(ApplicationSetting.defaults[:signup_enabled])
end
@@ -144,18 +140,16 @@ describe Gitlab::CurrentSettings do
end
end
- context 'with no ApplicationSetting DB record' do
- it_behaves_like 'a non-persisted ApplicationSetting object'
- end
-
- context 'with an existing ApplicationSetting DB record' do
- let!(:db_settings) { ApplicationSetting.build_from_defaults(home_page_url: 'http://mydomain.com').save! && ApplicationSetting.last }
- let(:current_settings) { described_class.current_application_settings }
+ context 'in a Rake task' do
+ before do
+ allow(Gitlab::Runtime).to receive(:rake?).and_return(true)
+ expect_any_instance_of(ActiveRecord::MigrationContext).to receive(:needs_migration?).and_return(true)
+ end
it_behaves_like 'a non-persisted ApplicationSetting object'
- it 'uses the value from the DB attribute if present and not overridden by an accessor' do
- expect(current_settings.home_page_url).to eq(db_settings.home_page_url)
+ it 'returns a FakeApplicationSettings object' do
+ expect(current_settings).to be_a(Gitlab::FakeApplicationSettings)
end
context 'when a new column is used before being migrated' do
@@ -168,6 +162,20 @@ describe Gitlab::CurrentSettings do
end
end
end
+
+ context 'with no ApplicationSetting DB record' do
+ it_behaves_like 'a non-persisted ApplicationSetting object'
+ end
+
+ context 'with an existing ApplicationSetting DB record' do
+ let!(:db_settings) { ApplicationSetting.build_from_defaults(home_page_url: 'http://mydomain.com').save! && ApplicationSetting.last }
+
+ it_behaves_like 'a non-persisted ApplicationSetting object'
+
+ it 'uses the value from the DB attribute if present and not overridden by an accessor' do
+ expect(current_settings.home_page_url).to eq(db_settings.home_page_url)
+ end
+ end
end
context 'when ApplicationSettings.current is present' do