diff options
author | Sean McGivern <sean@gitlab.com> | 2017-09-06 10:49:24 +0100 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2017-09-06 12:56:22 -0500 |
commit | cd84ce1a1b131edc500684f697798df401a69469 (patch) | |
tree | 383584ab1a8c11d1bffc50848f9a2236fc33283b /spec/migrations | |
parent | c3ac7311525bc23bd8b75addec34654aa87ebbae (diff) | |
download | gitlab-ce-cd84ce1a1b131edc500684f697798df401a69469.tar.gz |
Don't depend on user model in migration spec
The User model now has a default value for a field that didn't exist when these
migrations ran.
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/convert_custom_notification_settings_to_columns_spec.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/migrations/convert_custom_notification_settings_to_columns_spec.rb b/spec/migrations/convert_custom_notification_settings_to_columns_spec.rb index 1396d12e5a9..02312ddbf8a 100644 --- a/spec/migrations/convert_custom_notification_settings_to_columns_spec.rb +++ b/spec/migrations/convert_custom_notification_settings_to_columns_spec.rb @@ -2,6 +2,12 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20170607121233_convert_custom_notification_settings_to_columns') describe ConvertCustomNotificationSettingsToColumns, :migration do + let(:user_class) do + Class.new(ActiveRecord::Base) do + self.table_name = 'users' + end + end + let(:settings_params) do [ { level: 0, events: [:new_note] }, # disabled, single event @@ -19,7 +25,7 @@ describe ConvertCustomNotificationSettingsToColumns, :migration do events[event] = true end - user = create(:user) + user = build(:user).becomes(user_class).tap(&:save!) create_params = { user_id: user.id, level: params[:level], events: events } notification_setting = described_class::NotificationSetting.create(create_params) @@ -35,7 +41,7 @@ describe ConvertCustomNotificationSettingsToColumns, :migration do events[event] = true end - user = create(:user) + user = build(:user).becomes(user_class).tap(&:save!) create_params = events.merge(user_id: user.id, level: params[:level]) notification_setting = described_class::NotificationSetting.create(create_params) |