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
Léo-Paul Géneau
gitlab-ce
Commits
0853c234
Commit
0853c234
authored
Feb 21, 2019
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make assertions on objects instead of tag names
parent
28fcf5c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
spec/finders/autocomplete/acts_as_taggable_on/tags_finder_spec.rb
...ders/autocomplete/acts_as_taggable_on/tags_finder_spec.rb
+12
-12
No files found.
spec/finders/autocomplete/acts_as_taggable_on/tags_finder_spec.rb
View file @
0853c234
...
...
@@ -6,12 +6,12 @@ describe Autocomplete::ActsAsTaggableOn::TagsFinder do
describe
'#execute'
do
context
'with empty params'
do
it
'returns all tags'
do
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag1'
)
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag2'
)
tag1
=
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag1'
)
tag2
=
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag2'
)
tags
=
described_class
.
new
(
params:
{}).
execute
.
map
(
&
:name
)
tags
=
described_class
.
new
(
params:
{}).
execute
expect
(
tags
).
to
match_array
%w(tag1 tag2)
expect
(
tags
).
to
match_array
[
tag1
,
tag2
]
end
end
...
...
@@ -21,7 +21,7 @@ describe Autocomplete::ActsAsTaggableOn::TagsFinder do
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag1'
)
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag2'
)
tags
=
described_class
.
new
(
params:
{
search:
''
}).
execute
.
map
(
&
:name
)
tags
=
described_class
.
new
(
params:
{
search:
''
}).
execute
expect
(
tags
).
to
be_empty
end
...
...
@@ -29,23 +29,23 @@ describe Autocomplete::ActsAsTaggableOn::TagsFinder do
context
'with a search containing 2 characters'
do
it
'returns the tag that strictly matches the search term'
do
ActsAsTaggableOn
::
Tag
.
create!
(
name:
't1'
)
tag1
=
ActsAsTaggableOn
::
Tag
.
create!
(
name:
't1'
)
ActsAsTaggableOn
::
Tag
.
create!
(
name:
't11'
)
tags
=
described_class
.
new
(
params:
{
search:
't1'
}).
execute
.
map
(
&
:name
)
tags
=
described_class
.
new
(
params:
{
search:
't1'
}).
execute
expect
(
tags
).
to
match_array
[
't1'
]
expect
(
tags
).
to
match_array
[
tag1
]
end
end
context
'with a search containing 3 characters'
do
it
'returns the tag that partially matches the search term'
do
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag1'
)
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag11'
)
tag1
=
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag1'
)
tag2
=
ActsAsTaggableOn
::
Tag
.
create!
(
name:
'tag11'
)
tags
=
described_class
.
new
(
params:
{
search:
'ag1'
}).
execute
.
map
(
&
:name
)
tags
=
described_class
.
new
(
params:
{
search:
'ag1'
}).
execute
expect
(
tags
).
to
match_array
%w(tag1 tag11)
expect
(
tags
).
to
match_array
[
tag1
,
tag2
]
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