From d739e6e6e8a2e915a2a644383b5a4c2f4285fe09 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Wed, 20 Aug 2025 18:16:54 +0530 Subject: [PATCH] fix rubocop --- .../api/v1/accounts/leave_records_controller_spec.rb | 8 +++++--- spec/enterprise/models/leave_record_spec.rb | 2 +- spec/enterprise/policies/leave_record_policy_spec.rb | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spec/enterprise/controllers/api/v1/accounts/leave_records_controller_spec.rb b/spec/enterprise/controllers/api/v1/accounts/leave_records_controller_spec.rb index c10278eb0..6984f952b 100644 --- a/spec/enterprise/controllers/api/v1/accounts/leave_records_controller_spec.rb +++ b/spec/enterprise/controllers/api/v1/accounts/leave_records_controller_spec.rb @@ -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 \ No newline at end of file +end diff --git a/spec/enterprise/models/leave_record_spec.rb b/spec/enterprise/models/leave_record_spec.rb index 46f5a7396..e223f7458 100644 --- a/spec/enterprise/models/leave_record_spec.rb +++ b/spec/enterprise/models/leave_record_spec.rb @@ -127,4 +127,4 @@ RSpec.describe LeaveRecord, type: :model do expect(leave1.overlaps_with?(leave2)).to be false end end -end \ No newline at end of file +end diff --git a/spec/enterprise/policies/leave_record_policy_spec.rb b/spec/enterprise/policies/leave_record_policy_spec.rb index 45b1023da..5c06eb802 100644 --- a/spec/enterprise/policies/leave_record_policy_spec.rb +++ b/spec/enterprise/policies/leave_record_policy_spec.rb @@ -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 \ No newline at end of file +end