summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-09-06 10:49:24 +0100
committerRuben Davila <rdavila84@gmail.com>2017-09-06 12:56:22 -0500
commitcd84ce1a1b131edc500684f697798df401a69469 (patch)
tree383584ab1a8c11d1bffc50848f9a2236fc33283b /spec/lib
parentc3ac7311525bc23bd8b75addec34654aa87ebbae (diff)
downloadgitlab-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/lib')
-rw-r--r--spec/lib/gitlab/background_migration/migrate_events_to_push_event_payloads_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/lib/gitlab/background_migration/migrate_events_to_push_event_payloads_spec.rb b/spec/lib/gitlab/background_migration/migrate_events_to_push_event_payloads_spec.rb
index c56b08b18a2..f718339ca12 100644
--- a/spec/lib/gitlab/background_migration/migrate_events_to_push_event_payloads_spec.rb
+++ b/spec/lib/gitlab/background_migration/migrate_events_to_push_event_payloads_spec.rb
@@ -215,9 +215,16 @@ end
# to a specific version of the database where said table is still present.
#
describe Gitlab::BackgroundMigration::MigrateEventsToPushEventPayloads, :migration, schema: 20170825154015 do
+ let(:user_class) do
+ Class.new(ActiveRecord::Base) do
+ self.table_name = 'users'
+ end
+ end
+
let(:migration) { described_class.new }
- let(:project) { create(:project_empty_repo) }
- let(:author) { create(:user) }
+ let(:author) { build(:user).becomes(user_class).tap(&:save!).becomes(User) }
+ let(:namespace) { create(:namespace, owner: author) }
+ let(:project) { create(:project_empty_repo, namespace: namespace, creator: author) }
# We can not rely on FactoryGirl as the state of Event may change in ways that
# the background migration does not expect, hence we use the Event class of