Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Jul 26, 2024
1 parent 3a7997a commit d19bd8e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/helpers/person_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ def fetch_ptime_or_skills_data
def build_dropdown_data(ptime_employees)
ptime_employees.map do |ptime_employee|
ptime_employee_name = append_ptime_employee_name(ptime_employee)
person_id = Person.find_by(ptime_employee_id: ptime_employee[:id])
skills_person = Person.find_by(ptime_employee_id: ptime_employee[:id])
ptime_employee_id = ptime_employee[:id]
already_exists = ptime_employee_id.in?(Person.pluck(:ptime_employee_id))
path = new_person_path(ptime_employee_id: ptime_employee_id)
path = person_path(person_id) if already_exists
path = person_path(skills_person) if already_exists

[ptime_employee_name, path]
end
Expand Down
4 changes: 2 additions & 2 deletions spec/domain/ptime/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
end

it 'should not raise PTimeClientError if LAST_PTIME_ERROR is less than 5 minutes ago' do
ENV['LAST_PTIME_ERROR'] = 6.minutes.ago.to_s
stub_env_var("LAST_PTIME_ERROR", 6.minutes.ago.to_s)
fetched_employees = Ptime::Client.new.request(:get, "employees", { per_page: 1000 })
expect(fetched_employees).to eq(ptime_employees_data)
end

it 'should raise PTimeClientError if LAST_PTIME_ERROR is less than 5 minutes ago' do
ENV['LAST_PTIME_ERROR'] = 4.minutes.ago.to_s
stub_env_var("LAST_PTIME_ERROR", 4.minutes.ago.to_s)
expect {
Ptime::Client.new.request(:get, "employees", { per_page: 1000 })
}.to raise_error(CustomExceptions::PTimeClientError)
Expand Down
3 changes: 2 additions & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
stub_env_variables_and_request
end

config.before { allow($stdout).to receive(:puts) }
show_logs = ENV.fetch('SHOW_LOGS', false)
config.before { allow($stdout).to receive(:puts) } unless show_logs

# Controller helper
config.include(JsonMacros, type: :controller)
Expand Down

0 comments on commit d19bd8e

Please sign in to comment.