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
3447f97b
Commit
3447f97b
authored
Jun 22, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs for database migration helpers with transactions
parent
4419289b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
spec/lib/gitlab/database/migration_helpers_spec.rb
spec/lib/gitlab/database/migration_helpers_spec.rb
+8
-2
No files found.
spec/lib/gitlab/database/migration_helpers_spec.rb
View file @
3447f97b
...
@@ -317,7 +317,9 @@ describe Gitlab::Database::MigrationHelpers, lib: true do
...
@@ -317,7 +317,9 @@ describe Gitlab::Database::MigrationHelpers, lib: true do
context
'outside of a transaction'
do
context
'outside of a transaction'
do
context
'when a column limit is not set'
do
context
'when a column limit is not set'
do
before
do
before
do
expect
(
model
).
to
receive
(
:transaction_open?
).
and_return
(
false
)
expect
(
model
).
to
receive
(
:transaction_open?
)
.
and_return
(
false
)
.
at_least
(
:once
)
expect
(
model
).
to
receive
(
:transaction
).
and_yield
expect
(
model
).
to
receive
(
:transaction
).
and_yield
...
@@ -824,7 +826,11 @@ describe Gitlab::Database::MigrationHelpers, lib: true do
...
@@ -824,7 +826,11 @@ describe Gitlab::Database::MigrationHelpers, lib: true do
let!
(
:user
)
{
create
(
:user
,
name:
'Kathy Alice Aliceson'
)
}
let!
(
:user
)
{
create
(
:user
,
name:
'Kathy Alice Aliceson'
)
}
it
'replaces the correct part of the string'
do
it
'replaces the correct part of the string'
do
model
.
update_column_in_batches
(
:users
,
:name
,
model
.
replace_sql
(
Arel
::
Table
.
new
(
:users
)[
:name
],
'Alice'
,
'Eve'
))
allow
(
model
).
to
receive
(
:transaction_open?
).
and_return
(
false
)
query
=
model
.
replace_sql
(
Arel
::
Table
.
new
(
:users
)[
:name
],
'Alice'
,
'Eve'
)
model
.
update_column_in_batches
(
:users
,
:name
,
query
)
expect
(
user
.
reload
.
name
).
to
eq
(
'Kathy Eve Aliceson'
)
expect
(
user
.
reload
.
name
).
to
eq
(
'Kathy Eve Aliceson'
)
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