diff options
author | Stan Hu <stanhu@gmail.com> | 2017-06-17 17:35:30 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-06-19 19:54:48 +0300 |
commit | 575dced5d777e2e0db58ba8dbec6438456c9ff93 (patch) | |
tree | bce5df62399a6be5501e23a8771a047d2f26fdb6 /spec/factories | |
parent | 84cfb33fbb60898f9b56137832b2c5abb622465c (diff) |
If migrations are pending, make CurrentSettings use existing values and populate missing columns with defaults
master was failing because `ApplicationSetting.create_from_defaults` attempted
to write to a column that did not exist in the database. This occurred in a
`rake db:migrate` task, which was unable to perform the migration that would
have added the missing column in the first place.
In 9.3 RC2, we also had a bug where password sign-ins were disabled because
there were many pending migrations. The problem occurred because
`fake_application_settings` was being returned with an OpenStruct that did not
include the predicate method `signup_enabled?`. As a result, the value would
erroneously return `nil` instead of `true`. This commit uses the values of the
defaults to mimic this behavior.
This commit also refactors some of the logic to be clearer.
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/application_settings.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/factories/application_settings.rb b/spec/factories/application_settings.rb new file mode 100644 index 00000000000..aef65e724c2 --- /dev/null +++ b/spec/factories/application_settings.rb @@ -0,0 +1,4 @@ +FactoryGirl.define do + factory :application_setting do + end +end |