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
6824ba14
Commit
6824ba14
authored
Sep 28, 2020
by
sfang97
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRY user_spec terms, add term_spec
parent
af1be746
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
spec/features/users/terms_spec.rb
spec/features/users/terms_spec.rb
+1
-0
spec/models/application_setting/term_spec.rb
spec/models/application_setting/term_spec.rb
+5
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+12
-8
No files found.
spec/features/users/terms_spec.rb
View file @
6824ba14
...
...
@@ -35,6 +35,7 @@ RSpec.describe 'Users > Terms' do
it
'auto accepts the terms'
do
visit
terms_path
expect
(
page
).
not_to
have_content
(
'Accept terms'
)
expect
(
project_bot
.
terms_accepted?
).
to
be
(
true
)
end
...
...
spec/models/application_setting/term_spec.rb
View file @
6824ba14
...
...
@@ -17,6 +17,7 @@ RSpec.describe ApplicationSetting::Term do
describe
'#accepted_by_user?'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project_bot
)
{
create
(
:user
,
:project_bot
)
}
let
(
:term
)
{
create
(
:term
)
}
it
'is true when the user accepted the terms'
do
...
...
@@ -25,6 +26,10 @@ RSpec.describe ApplicationSetting::Term do
expect
(
term
.
accepted_by_user?
(
user
)).
to
be
(
true
)
end
it
'is true when user is a bot'
do
expect
(
term
.
accepted_by_user?
(
project_bot
)).
to
be
(
true
)
end
it
'is false when the user declined the terms'
do
decline_terms
(
term
,
user
)
...
...
spec/models/user_spec.rb
View file @
6824ba14
...
...
@@ -4330,6 +4330,7 @@ RSpec.describe User do
describe
'#required_terms_not_accepted?'
do
let
(
:user
)
{
build
(
:user
)
}
let
(
:project_bot
)
{
create
(
:user
,
:project_bot
)
}
subject
{
user
.
required_terms_not_accepted?
}
...
...
@@ -4337,21 +4338,24 @@ RSpec.describe User do
it
{
is_expected
.
to
be_falsy
}
end
context
"when terms are enforced
and accepted by the user
"
do
context
"when terms are enforced"
do
before
do
enforce_terms
accept_terms
(
user
)
end
it
{
is_expected
.
to
be_falsy
}
end
it
"is accepted by the user"
do
accept_terms
(
user
)
context
"when terms are enforced but the user has not accepted"
do
before
do
enforce_terms
it
{
is_expected
.
to
be_falsy
}
end
it
"is not accepted by the user"
do
it
{
is_expected
.
to
be_truthy
}
end
it
{
is_expected
.
to
be_truthy
}
it
"auto accepts the term for project bots"
do
expect
(
project_bot
.
required_terms_not_accepted?
).
to
be_falsy
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