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
Jérome Perrin
gitlab-ce
Commits
7d2f9e5a
Commit
7d2f9e5a
authored
Dec 14, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
400086b3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
75 deletions
+1
-75
spec/models/user_spec.rb
spec/models/user_spec.rb
+0
-74
spec/requests/api/helpers_spec.rb
spec/requests/api/helpers_spec.rb
+1
-1
No files found.
spec/models/user_spec.rb
View file @
7d2f9e5a
...
@@ -599,80 +599,6 @@ describe User, models: true do
...
@@ -599,80 +599,6 @@ describe User, models: true do
end
end
end
end
describe
'.search_with_secondary_emails'
do
def
search_with_secondary_emails
(
query
)
described_class
.
search_with_secondary_emails
(
query
)
end
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:email
)
{
create
(
:email
)
}
it
'returns users with a matching name'
do
expect
(
search_with_secondary_emails
(
user
.
name
)).
to
eq
([
user
])
end
it
'returns users with a partially matching name'
do
expect
(
search_with_secondary_emails
(
user
.
name
[
0
..
2
])).
to
eq
([
user
])
end
it
'returns users with a matching name regardless of the casing'
do
expect
(
search_with_secondary_emails
(
user
.
name
.
upcase
)).
to
eq
([
user
])
end
it
'returns users with a matching email'
do
expect
(
search_with_secondary_emails
(
user
.
email
)).
to
eq
([
user
])
end
it
'returns users with a partially matching email'
do
expect
(
search_with_secondary_emails
(
user
.
email
[
0
..
2
])).
to
eq
([
user
])
end
it
'returns users with a matching email regardless of the casing'
do
expect
(
search_with_secondary_emails
(
user
.
email
.
upcase
)).
to
eq
([
user
])
end
it
'returns users with a matching username'
do
expect
(
search_with_secondary_emails
(
user
.
username
)).
to
eq
([
user
])
end
it
'returns users with a partially matching username'
do
expect
(
search_with_secondary_emails
(
user
.
username
[
0
..
2
])).
to
eq
([
user
])
end
it
'returns users with a matching username regardless of the casing'
do
expect
(
search_with_secondary_emails
(
user
.
username
.
upcase
)).
to
eq
([
user
])
end
it
'returns users with a matching whole secondary email'
do
expect
(
search_with_secondary_emails
(
email
.
email
)).
to
eq
([
email
.
user
])
end
it
'returns users with a matching part of secondary email'
do
expect
(
search_with_secondary_emails
(
email
.
email
[
1
..
4
])).
to
eq
([
email
.
user
])
end
it
'return users with a matching part of secondary email regardless of case'
do
expect
(
search_with_secondary_emails
(
email
.
email
[
1
..
4
].
upcase
)).
to
eq
([
email
.
user
])
expect
(
search_with_secondary_emails
(
email
.
email
[
1
..
4
].
downcase
)).
to
eq
([
email
.
user
])
expect
(
search_with_secondary_emails
(
email
.
email
[
1
..
4
].
capitalize
)).
to
eq
([
email
.
user
])
end
it
'returns multiple users with matching secondary emails'
do
email1
=
create
(
:email
,
email:
'1_testemail@example.com'
)
email2
=
create
(
:email
,
email:
'2_testemail@example.com'
)
email3
=
create
(
:email
,
email:
'other@email.com'
)
email3
.
user
.
update_attributes!
(
email:
'another@mail.com'
)
expect
(
search_with_secondary_emails
(
'testemail@example.com'
).
map
(
&
:id
)
).
to
include
(
email1
.
user
.
id
,
email2
.
user
.
id
)
expect
(
search_with_secondary_emails
(
'testemail@example.com'
).
map
(
&
:id
)
).
not_to
include
(
email3
.
user
.
id
)
end
end
describe
'.find_by_ssh_key_id'
do
describe
'.find_by_ssh_key_id'
do
context
'using an existing SSH key ID'
do
context
'using an existing SSH key ID'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/requests/api/helpers_spec.rb
View file @
7d2f9e5a
...
@@ -46,7 +46,7 @@ describe API::Helpers, api: true do
...
@@ -46,7 +46,7 @@ describe API::Helpers, api: true do
end
end
def
error!
(
message
,
status
)
def
error!
(
message
,
status
)
raise
Exception
raise
Exception
.
new
(
"
#{
status
}
-
#{
message
}
"
)
end
end
describe
".current_user"
do
describe
".current_user"
do
...
...
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