fix rubocop

This commit is contained in:
Tanmay Deep Sharma
2025-08-20 18:16:54 +05:30
parent 2d320bff17
commit d739e6e6e8
3 changed files with 9 additions and 7 deletions
@@ -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
+1 -1
View File
@@ -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