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
7d57b110
Commit
7d57b110
authored
May 27, 2016
by
DJ Mountney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tests for the current_application_settings request store changes
parent
14b0fb51
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
12 deletions
+12
-12
spec/controllers/registrations_controller_spec.rb
spec/controllers/registrations_controller_spec.rb
+2
-2
spec/lib/gitlab/akismet_helper_spec.rb
spec/lib/gitlab/akismet_helper_spec.rb
+2
-2
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+3
-3
spec/models/user_spec.rb
spec/models/user_spec.rb
+4
-4
spec/services/groups/create_service_spec.rb
spec/services/groups/create_service_spec.rb
+1
-1
No files found.
spec/controllers/registrations_controller_spec.rb
View file @
7d57b110
...
@@ -11,7 +11,7 @@ describe RegistrationsController do
...
@@ -11,7 +11,7 @@ describe RegistrationsController do
let
(
:user_params
)
{
{
user:
{
name:
"new_user"
,
username:
"new_username"
,
email:
"new@user.com"
,
password:
"Any_password"
}
}
}
let
(
:user_params
)
{
{
user:
{
name:
"new_user"
,
username:
"new_username"
,
email:
"new@user.com"
,
password:
"Any_password"
}
}
}
context
'when sending email confirmation'
do
context
'when sending email confirmation'
do
before
{
allow
(
current_application_settings
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
false
)
}
before
{
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
false
)
}
it
'logs user in directly'
do
it
'logs user in directly'
do
post
(
:create
,
user_params
)
post
(
:create
,
user_params
)
...
@@ -21,7 +21,7 @@ describe RegistrationsController do
...
@@ -21,7 +21,7 @@ describe RegistrationsController do
end
end
context
'when not sending email confirmation'
do
context
'when not sending email confirmation'
do
before
{
allow
(
current_application_settings
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
before
{
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
it
'does not authenticate user and sends confirmation email'
do
it
'does not authenticate user and sends confirmation email'
do
post
(
:create
,
user_params
)
post
(
:create
,
user_params
)
...
...
spec/lib/gitlab/akismet_helper_spec.rb
View file @
7d57b110
...
@@ -6,8 +6,8 @@ describe Gitlab::AkismetHelper, type: :helper do
...
@@ -6,8 +6,8 @@ describe Gitlab::AkismetHelper, type: :helper do
before
do
before
do
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:url
).
and_return
(
Settings
.
send
(
:build_gitlab_url
))
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:url
).
and_return
(
Settings
.
send
(
:build_gitlab_url
))
current_application_settings
.
akismet_enabled
=
true
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:akismet_enabled
).
and_return
(
true
)
current_application_settings
.
akismet_api_key
=
'12345'
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:akismet_api_key
).
and_return
(
'12345'
)
end
end
describe
'#check_for_spam?'
do
describe
'#check_for_spam?'
do
...
...
spec/mailers/notify_spec.rb
View file @
7d57b110
...
@@ -51,7 +51,7 @@ describe Notify do
...
@@ -51,7 +51,7 @@ describe Notify do
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow
(
current_application_settings
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
@@ -230,7 +230,7 @@ describe Notify do
...
@@ -230,7 +230,7 @@ describe Notify do
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow
(
current_application_settings
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
@@ -454,7 +454,7 @@ describe Notify do
...
@@ -454,7 +454,7 @@ describe Notify do
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow
(
current_application_settings
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
...
spec/models/user_spec.rb
View file @
7d57b110
...
@@ -67,7 +67,7 @@ describe User, models: true do
...
@@ -67,7 +67,7 @@ describe User, models: true do
describe
'email'
do
describe
'email'
do
context
'when no signup domains listed'
do
context
'when no signup domains listed'
do
before
{
allow
(
current_application_settings
).
to
receive
(
:restricted_signup_domains
).
and_return
([])
}
before
{
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:restricted_signup_domains
).
and_return
([])
}
it
'accepts any email'
do
it
'accepts any email'
do
user
=
build
(
:user
,
email:
"info@example.com"
)
user
=
build
(
:user
,
email:
"info@example.com"
)
expect
(
user
).
to
be_valid
expect
(
user
).
to
be_valid
...
@@ -75,7 +75,7 @@ describe User, models: true do
...
@@ -75,7 +75,7 @@ describe User, models: true do
end
end
context
'when a signup domain is listed and subdomains are allowed'
do
context
'when a signup domain is listed and subdomains are allowed'
do
before
{
allow
(
current_application_settings
).
to
receive
(
:restricted_signup_domains
).
and_return
([
'example.com'
,
'*.example.com'
])
}
before
{
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:restricted_signup_domains
).
and_return
([
'example.com'
,
'*.example.com'
])
}
it
'accepts info@example.com'
do
it
'accepts info@example.com'
do
user
=
build
(
:user
,
email:
"info@example.com"
)
user
=
build
(
:user
,
email:
"info@example.com"
)
expect
(
user
).
to
be_valid
expect
(
user
).
to
be_valid
...
@@ -93,7 +93,7 @@ describe User, models: true do
...
@@ -93,7 +93,7 @@ describe User, models: true do
end
end
context
'when a signup domain is listed and subdomains are not allowed'
do
context
'when a signup domain is listed and subdomains are not allowed'
do
before
{
allow
(
current_application_settings
).
to
receive
(
:restricted_signup_domains
).
and_return
([
'example.com'
])
}
before
{
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:restricted_signup_domains
).
and_return
([
'example.com'
])
}
it
'accepts info@example.com'
do
it
'accepts info@example.com'
do
user
=
build
(
:user
,
email:
"info@example.com"
)
user
=
build
(
:user
,
email:
"info@example.com"
)
...
@@ -141,7 +141,7 @@ describe User, models: true do
...
@@ -141,7 +141,7 @@ describe User, models: true do
end
end
describe
'#confirm'
do
describe
'#confirm'
do
before
{
allow
(
current_application_settings
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
before
{
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
let
(
:user
)
{
create
(
:user
,
confirmed_at:
nil
,
unconfirmed_email:
'test@gitlab.com'
)
}
let
(
:user
)
{
create
(
:user
,
confirmed_at:
nil
,
unconfirmed_email:
'test@gitlab.com'
)
}
it
'returns unconfirmed'
do
it
'returns unconfirmed'
do
...
...
spec/services/groups/create_service_spec.rb
View file @
7d57b110
...
@@ -13,7 +13,7 @@ describe Groups::CreateService, services: true do
...
@@ -13,7 +13,7 @@ describe Groups::CreateService, services: true do
end
end
context
"cannot create group with restricted visibility level"
do
context
"cannot create group with restricted visibility level"
do
before
{
allow
(
current_application_settings
).
to
receive
(
:restricted_visibility_levels
).
and_return
([
Gitlab
::
VisibilityLevel
::
PUBLIC
])
}
before
{
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:restricted_visibility_levels
).
and_return
([
Gitlab
::
VisibilityLevel
::
PUBLIC
])
}
it
{
is_expected
.
not_to
be_persisted
}
it
{
is_expected
.
not_to
be_persisted
}
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