fix rubocop
This commit is contained in:
@@ -7,8 +7,10 @@ RSpec.describe 'LeaveRecords API', type: :request do
|
||||
let(:other_agent) { create(:user, account: account, role: :agent) }
|
||||
|
||||
describe 'GET /api/v1/accounts/:account_id/leave_records' do
|
||||
let!(:agent_leave) { create(:leave_record, account: account, user: agent) }
|
||||
let!(:other_leave) { create(:leave_record, account: account, user: other_agent) }
|
||||
before do
|
||||
create(:leave_record, account: account, user: agent)
|
||||
create(:leave_record, account: account, user: other_agent)
|
||||
end
|
||||
|
||||
it 'allows admins to see all leave records' do
|
||||
get "/api/v1/accounts/#{account.id}/leave_records",
|
||||
@@ -147,4 +149,4 @@ RSpec.describe 'LeaveRecords API', type: :request do
|
||||
def json_response
|
||||
JSON.parse(response.body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -127,4 +127,4 @@ RSpec.describe LeaveRecord, type: :model do
|
||||
expect(leave1.overlaps_with?(leave2)).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ RSpec.describe LeaveRecordPolicy, type: :policy do
|
||||
let(:leave_record) { create(:leave_record, account: account, user: agent) }
|
||||
|
||||
describe 'permissions' do
|
||||
context 'for administrators' do
|
||||
context 'when user is administrator' do
|
||||
let(:policy) { described_class.new(pundit_context(admin), leave_record) }
|
||||
|
||||
it 'permits all actions' do
|
||||
@@ -21,7 +21,7 @@ RSpec.describe LeaveRecordPolicy, type: :policy do
|
||||
end
|
||||
end
|
||||
|
||||
context 'for agents' do
|
||||
context 'when user is agent' do
|
||||
let(:policy) { described_class.new(pundit_context(agent), leave_record) }
|
||||
|
||||
it 'permits basic actions' do
|
||||
@@ -72,4 +72,4 @@ RSpec.describe LeaveRecordPolicy, type: :policy do
|
||||
account_user: user.account_users.find_by(account: account)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user