Commit 245d4abb authored by Adam Niedzielski's avatar Adam Niedzielski

Single quotes all the way.

parent 0c3ac827
...@@ -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
......
...@@ -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
......
...@@ -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
......
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment