BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
cd84ce1a
Commit
cd84ce1a
authored
Sep 06, 2017
by
Sean McGivern
Committed by
Ruben Davila
Sep 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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.
parent
c3ac7311
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
migrate_events_to_push_event_payloads_spec.rb
...d_migration/migrate_events_to_push_event_payloads_spec.rb
+9
-2
convert_custom_notification_settings_to_columns_spec.rb
...s/convert_custom_notification_settings_to_columns_spec.rb
+8
-2
No files found.
spec/lib/gitlab/background_migration/migrate_events_to_push_event_payloads_spec.rb
View file @
cd84ce1a
...
...
@@ -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
...
...
spec/migrations/convert_custom_notification_settings_to_columns_spec.rb
View file @
cd84ce1a
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment