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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
1ef3b3ef
Commit
1ef3b3ef
authored
Jun 27, 2018
by
DJ Mountney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tests for gitlab:db:configure
parent
a9fcf968
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
spec/tasks/gitlab/db_rake_spec.rb
spec/tasks/gitlab/db_rake_spec.rb
+9
-1
No files found.
spec/tasks/gitlab/db_rake_spec.rb
View file @
1ef3b3ef
...
@@ -20,7 +20,7 @@ describe 'gitlab:db namespace rake task' do
...
@@ -20,7 +20,7 @@ describe 'gitlab:db namespace rake task' do
describe
'configure'
do
describe
'configure'
do
it
'invokes db:migrate when schema has already been loaded'
do
it
'invokes db:migrate when schema has already been loaded'
do
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:tables
).
and_return
([
'
default
'
])
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:tables
).
and_return
([
'
table1'
,
'table2
'
])
expect
(
Rake
::
Task
[
'db:migrate'
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
'db:migrate'
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
'db:schema:load'
]).
not_to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
'db:schema:load'
]).
not_to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
'db:seed_fu'
]).
not_to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
'db:seed_fu'
]).
not_to
receive
(
:invoke
)
...
@@ -35,6 +35,14 @@ describe 'gitlab:db namespace rake task' do
...
@@ -35,6 +35,14 @@ describe 'gitlab:db namespace rake task' do
expect
{
run_rake_task
(
'gitlab:db:configure'
)
}.
not_to
raise_error
expect
{
run_rake_task
(
'gitlab:db:configure'
)
}.
not_to
raise_error
end
end
it
'invokes db:shema:load and db:seed_fu when there is only a single table present'
do
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:tables
).
and_return
([
'default'
])
expect
(
Rake
::
Task
[
'db:schema:load'
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
'db:seed_fu'
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
'db:migrate'
]).
not_to
receive
(
:invoke
)
expect
{
run_rake_task
(
'gitlab:db:configure'
)
}.
not_to
raise_error
end
it
'does not invoke any other rake tasks during an error'
do
it
'does not invoke any other rake tasks during an error'
do
allow
(
ActiveRecord
::
Base
).
to
receive
(
:connection
).
and_raise
(
RuntimeError
,
'error'
)
allow
(
ActiveRecord
::
Base
).
to
receive
(
:connection
).
and_raise
(
RuntimeError
,
'error'
)
expect
(
Rake
::
Task
[
'db:migrate'
]).
not_to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
'db:migrate'
]).
not_to
receive
(
:invoke
)
...
...
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