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
fe530ef6
Commit
fe530ef6
authored
Mar 29, 2022
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does not create a dev:copy_db:geo task
parent
9e09dbac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
19 deletions
+33
-19
lib/tasks/dev.rake
lib/tasks/dev.rake
+3
-1
spec/tasks/dev_rake_spec.rb
spec/tasks/dev_rake_spec.rb
+30
-18
No files found.
lib/tasks/dev.rake
View file @
fe530ef6
...
...
@@ -30,8 +30,10 @@ namespace :dev do
databases
=
ActiveRecord
::
Tasks
::
DatabaseTasks
.
setup_initial_database_yaml
namespace
:copy_db
do
ALLOWED_DATABASES
=
%w[ci]
.
freeze
ActiveRecord
::
Tasks
::
DatabaseTasks
.
for_each
(
databases
)
do
|
name
|
next
if
name
==
'main'
next
unless
ALLOWED_DATABASES
.
include?
(
name
)
desc
"Copies the
#{
name
}
database from the main database"
task
name
=>
:environment
do
...
...
spec/tasks/dev_rake_spec.rb
View file @
fe530ef6
...
...
@@ -40,10 +40,14 @@ RSpec.describe 'dev rake tasks' do
end
end
describe
'copy_db:ci
'
do
context
'multiple databases
'
do
before
do
skip_if_multiple_databases_not_setup
end
context
'with a valid database'
do
describe
'copy_db:ci'
do
before
do
configurations
=
instance_double
(
ActiveRecord
::
DatabaseConfigurations
)
allow
(
ActiveRecord
::
Base
).
to
receive
(
:configurations
).
and_return
(
configurations
)
allow
(
configurations
).
to
receive
(
:configs_for
).
with
(
env_name:
Rails
.
env
,
name:
'ci'
).
and_return
(
ci_configuration
)
...
...
@@ -70,4 +74,12 @@ RSpec.describe 'dev rake tasks' do
end
end
end
end
context
'with an invalid database'
do
it
'raises an error'
do
expect
{
run_rake_task
(
'dev:copy_db:foo'
)
}.
to
raise_error
(
RuntimeError
,
/Don't know how to build task/
)
end
end
end
end
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