summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2019-03-26 15:33:56 +0100
committerRémy Coutable <remy@rymai.me>2019-03-26 23:02:57 +0100
commit90718774e19d333a64f6625f0ac23b8508f37e56 (patch)
tree7f135a424cdaf291fe6612168d4e47098bf17737 /spec/lib
parent81fe9e9b2e670cc7dcd9405e336f72cabc5a14ba (diff)
downloadgitlab-ce-90718774e19d333a64f6625f0ac23b8508f37e56.tar.gz
Use a Gitlab::FakeApplicationSettings when migrations are pending
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/current_settings_spec.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/lib/gitlab/current_settings_spec.rb b/spec/lib/gitlab/current_settings_spec.rb
index 17d5eae24f5..cdf2ad1d962 100644
--- a/spec/lib/gitlab/current_settings_spec.rb
+++ b/spec/lib/gitlab/current_settings_spec.rb
@@ -116,8 +116,7 @@ describe Gitlab::CurrentSettings do
let(:current_settings) { described_class.current_application_settings }
it 'returns a non-persisted ApplicationSetting object' do
- expect(current_settings).to be_a(ApplicationSetting)
- expect(current_settings).not_to be_persisted
+ expect(current_settings).to be_a(Gitlab::FakeApplicationSettings)
end
it 'uses the default value from ApplicationSetting.defaults' do
@@ -146,6 +145,16 @@ describe Gitlab::CurrentSettings do
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
+
+ context 'when a new column is used before being migrated' do
+ before do
+ allow(ApplicationSetting).to receive(:defaults).and_return({ foo: 'bar' })
+ end
+
+ it 'uses the default value if present' do
+ expect(current_settings.foo).to eq('bar')
+ end
+ end
end
end