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
245d4abb
Commit
245d4abb
authored
Aug 07, 2016
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Single quotes all the way.
parent
0c3ac827
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
app/views/shared/members/_member.html.haml
app/views/shared/members/_member.html.haml
+1
-1
app/workers/remove_expired_members_worker.rb
app/workers/remove_expired_members_worker.rb
+1
-1
spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb
...s/members/master_adds_member_with_expiration_date_spec.rb
+5
-5
spec/workers/remove_expired_members_worker_spec.rb
spec/workers/remove_expired_members_worker_spec.rb
+4
-4
No files found.
app/views/shared/members/_member.html.haml
View file @
245d4abb
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
Joined
#{
time_ago_with_tooltip
(
member
.
created_at
)
}
Joined
#{
time_ago_with_tooltip
(
member
.
created_at
)
}
-
if
member
.
expires?
-
if
member
.
expires?
·
·
%span
{
class:
(
"text-warning"
if
member_expires_soon?
(
member
))
}
%span
{
class:
(
'text-warning'
if
member_expires_soon?
(
member
))
}
Expires in
#{
distance_of_time_in_words_to_now
(
member
.
expires_at
)
}
Expires in
#{
distance_of_time_in_words_to_now
(
member
.
expires_at
)
}
-
else
-
else
...
...
app/workers/remove_expired_members_worker.rb
View file @
245d4abb
...
@@ -2,7 +2,7 @@ class RemoveExpiredMembersWorker
...
@@ -2,7 +2,7 @@ class RemoveExpiredMembersWorker
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
def
perform
def
perform
Member
.
where
(
"expires_at <= ?"
,
Time
.
current
).
find_each
do
|
member
|
Member
.
where
(
'expires_at <= ?'
,
Time
.
current
).
find_each
do
|
member
|
begin
begin
Members
::
AuthorizedDestroyService
.
new
(
member
).
execute
Members
::
AuthorizedDestroyService
.
new
(
member
).
execute
rescue
=>
ex
rescue
=>
ex
...
...
spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb
View file @
245d4abb
...
@@ -14,12 +14,12 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
...
@@ -14,12 +14,12 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
end
end
scenario
'expiration date is displayed in the members list'
do
scenario
'expiration date is displayed in the members list'
do
travel_to
Time
.
zone
.
parse
(
"2016-08-06 08:00"
)
do
travel_to
Time
.
zone
.
parse
(
'2016-08-06 08:00'
)
do
visit
namespace_project_project_members_path
(
project
.
namespace
,
project
)
visit
namespace_project_project_members_path
(
project
.
namespace
,
project
)
page
.
within
'.users-project-form'
do
page
.
within
'.users-project-form'
do
select2
(
new_member
.
id
,
from:
'#user_ids'
,
multiple:
true
)
select2
(
new_member
.
id
,
from:
'#user_ids'
,
multiple:
true
)
fill_in
'Access expiration date'
,
with:
"2016-08-10"
fill_in
'Access expiration date'
,
with:
'2016-08-10'
click_on
'Add users to project'
click_on
'Add users to project'
end
end
...
@@ -30,13 +30,13 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
...
@@ -30,13 +30,13 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
end
end
scenario
'change expiration date'
do
scenario
'change expiration date'
do
travel_to
Time
.
zone
.
parse
(
"2016-08-06 08:00"
)
do
travel_to
Time
.
zone
.
parse
(
'2016-08-06 08:00'
)
do
project
.
team
.
add_users
([
new_member
.
id
],
:developer
,
expires_at:
"2016-09-06"
)
project
.
team
.
add_users
([
new_member
.
id
],
:developer
,
expires_at:
'2016-09-06'
)
visit
namespace_project_project_members_path
(
project
.
namespace
,
project
)
visit
namespace_project_project_members_path
(
project
.
namespace
,
project
)
page
.
within
'.project_member:first-child'
do
page
.
within
'.project_member:first-child'
do
click_on
'Edit'
click_on
'Edit'
fill_in
'Access expiration date'
,
with:
"2016-08-09"
fill_in
'Access expiration date'
,
with:
'2016-08-09'
click_on
'Save'
click_on
'Save'
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
end
end
...
...
spec/workers/remove_expired_members_worker_spec.rb
View file @
245d4abb
...
@@ -6,18 +6,18 @@ describe RemoveExpiredMembersWorker do
...
@@ -6,18 +6,18 @@ describe RemoveExpiredMembersWorker do
let!
(
:member_expiring_in_future
)
{
create
(
:project_member
,
expires_at:
10
.
days
.
from_now
)
}
let!
(
:member_expiring_in_future
)
{
create
(
:project_member
,
expires_at:
10
.
days
.
from_now
)
}
let!
(
:non_expiring_member
)
{
create
(
:project_member
,
expires_at:
nil
)
}
let!
(
:non_expiring_member
)
{
create
(
:project_member
,
expires_at:
nil
)
}
describe
"#perform"
do
describe
'#perform'
do
it
"removes expired members"
do
it
'removes expired members'
do
expect
{
worker
.
perform
}.
to
change
{
Member
.
count
}.
by
(
-
1
)
expect
{
worker
.
perform
}.
to
change
{
Member
.
count
}.
by
(
-
1
)
expect
(
Member
.
find_by
(
id:
expired_member
.
id
)).
to
be_nil
expect
(
Member
.
find_by
(
id:
expired_member
.
id
)).
to
be_nil
end
end
it
"leaves members who expire in the future"
do
it
'leaves members who expire in the future'
do
worker
.
perform
worker
.
perform
expect
(
member_expiring_in_future
.
reload
).
to
be_present
expect
(
member_expiring_in_future
.
reload
).
to
be_present
end
end
it
"leaves members who do not expire at all"
do
it
'leaves members who do not expire at all'
do
worker
.
perform
worker
.
perform
expect
(
non_expiring_member
.
reload
).
to
be_present
expect
(
non_expiring_member
.
reload
).
to
be_present
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