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
d9d687b0
Commit
d9d687b0
authored
Mar 09, 2020
by
Matthias Kaeppler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify test that checks IDs are set on insertion
parent
43131110
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
spec/models/concerns/bulk_insertable_associations_spec.rb
spec/models/concerns/bulk_insertable_associations_spec.rb
+2
-6
No files found.
spec/models/concerns/bulk_insertable_associations_spec.rb
View file @
d9d687b0
...
...
@@ -57,16 +57,12 @@ describe BulkInsertableAssociations do
end
end
before
do
ActiveRecord
::
Base
.
connection
.
execute
(
'TRUNCATE bulk_foos RESTART IDENTITY'
)
end
context
'saving bulk insertable associations'
do
let
(
:parent
)
{
BulkParent
.
new
(
name:
'parent'
)
}
context
'when items already have IDs'
do
it
'stores nothing and raises an error'
do
build_items
(
parent:
parent
)
{
|
n
,
item
|
item
.
id
=
100
+
n
}
build_items
(
parent:
parent
)
{
|
n
,
item
|
item
.
id
=
n
}
expect
{
save_with_bulk_inserts
(
parent
)
}.
to
raise_error
(
BulkInsertSafe
::
PrimaryKeySetError
)
expect
(
BulkFoo
.
count
).
to
eq
(
0
)
...
...
@@ -79,7 +75,7 @@ describe BulkInsertableAssociations do
expect
(
BulkFoo
).
to
receive
(
:bulk_insert!
).
once
.
and_call_original
expect
{
save_with_bulk_inserts
(
parent
)
}.
to
change
{
BulkFoo
.
count
}.
from
(
0
).
to
(
items
.
size
)
expect
(
parent
.
bulk_foos
.
pluck
(
:id
)).
to
contain_exactly
(
*
(
1
..
10
)
)
expect
(
parent
.
bulk_foos
.
pluck
(
:id
)).
to
all
(
be_a
Integer
)
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