Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
25ef6f51
Commit
25ef6f51
authored
Dec 15, 2018
by
Lin Jen-Shin
Committed by
Rémy Coutable
Dec 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use fake application settings for migration tests
parent
0ff27ce0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
spec/spec_helper.rb
spec/spec_helper.rb
+2
-0
spec/support/helpers/migrations_helpers.rb
spec/support/helpers/migrations_helpers.rb
+16
-0
No files found.
spec/spec_helper.rb
View file @
25ef6f51
...
...
@@ -216,6 +216,8 @@ RSpec.configure do |config|
# Each example may call `migrate!`, so we must ensure we are migrated down every time
config
.
before
(
:each
,
:migration
)
do
use_fake_application_settings
schema_migrate_down!
end
...
...
spec/support/helpers/migrations_helpers.rb
View file @
25ef6f51
...
...
@@ -62,6 +62,22 @@ module MigrationsHelpers
klass
.
reset_column_information
end
# In some migration tests, we're using factories to create records,
# however those models might be depending on a schema version which
# doesn't have the columns we want in application_settings.
# In these cases, we'll need to use the fake application settings
# as if we have migrations pending
def
use_fake_application_settings
# We stub this way because we can't stub on
# `current_application_settings` due to `method_missing` is
# depending on current_application_settings...
allow
(
ActiveRecord
::
Base
.
connection
)
.
to
receive
(
:active?
)
.
and_return
(
false
)
stub_env
(
'IN_MEMORY_APPLICATION_SETTINGS'
,
'false'
)
end
def
previous_migration
migrations
.
each_cons
(
2
)
do
|
previous
,
migration
|
break
previous
if
migration
.
name
==
described_class
.
name
...
...
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