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
470c491e
Commit
470c491e
authored
Mar 04, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maintain Geo database schema in tests
parent
87934901
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
app/models/geo/base_registry.rb
app/models/geo/base_registry.rb
+1
-1
spec/spec_helper.rb
spec/spec_helper.rb
+14
-0
No files found.
app/models/geo/base_registry.rb
View file @
470c491e
class
Geo::BaseRegistry
<
ActiveRecord
::
Base
self
.
abstract_class
=
true
if
Gitlab
::
Geo
.
secondary?
if
Gitlab
::
Geo
.
secondary?
||
Rails
.
env
.
test?
establish_connection
Rails
.
configuration
.
geo_database
end
end
spec/spec_helper.rb
View file @
470c491e
...
...
@@ -79,4 +79,18 @@ FactoryGirl::SyntaxRunner.class_eval do
include
RSpec
::
Mocks
::
ExampleMethods
end
#
# Maintain Geo database schema in tests. Unfortunately, we cannot simply use
# ActiveRecord::Migration.maintain_test_schema! because it hardcodes the rake
# task name:
#
# https://github.com/rails/rails/blob/master/activerecord/lib/active_record/migration.rb#L585
#
FileUtils
.
cd
Rails
.
root
do
Geo
::
BaseRegistry
.
clear_all_connections!
system
(
"bin/rake geo:db:test:prepare"
)
# Establish a new connection, the old database may be gone (db:test:prepare uses purge)
Geo
::
BaseRegistry
.
establish_connection
(
Rails
.
configuration
.
geo_database
)
end
ActiveRecord
::
Migration
.
maintain_test_schema!
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