Skip to content

Commit

Permalink
Update Applicants#advance_applicant to support funnel_id (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
abrom authored Apr 30, 2024
1 parent ac1b980 commit 1a7fd4e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/fountain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'fountain/gem_version'

require 'json'
require 'forwardable'

require 'fountain/configuration'
require 'fountain/util'
Expand Down
2 changes: 1 addition & 1 deletion lib/fountain/api/applicants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def self.advance_applicant(applicant_id, advance_options = {})
method: :put,
body: Util.slice_hash(
advance_options,
:skip_automated_actions, :stage_id
:skip_automated_actions, :stage_id, :funnel_id
)
)
check_response response, Net::HTTPNoContent
Expand Down
21 changes: 21 additions & 0 deletions spec/fountain/api/applicants_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@
}.to_json
)
.to_return(status: 204)

stub_authed_request(:put, '/v2/applicants/01234567-0000-0000-0000-000000000002/advance')
.with(
body: {
skip_automated_actions: true,
stage_id: 'stage-id',
funnel_id: 'funnel-id'
}.to_json
)
.to_return(status: 204)
end

it 'advances an applicant' do
Expand All @@ -365,6 +375,17 @@
)
expect(result).to be true
end

it 'advances an applicant to a specific stage and funnel (ignoring non-standard arguments)' do
result = described_class.advance_applicant(
'01234567-0000-0000-0000-000000000002',
skip_automated_actions: true,
stage_id: 'stage-id',
funnel_id: 'funnel-id',
invalid_arg: 'should not be included'
)
expect(result).to be true
end
end

describe '.advance_applicants' do
Expand Down
6 changes: 4 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

require 'simplecov'
SimpleCov.start
if ENV['CI'] == 'true'
require 'simplecov'
SimpleCov.start
end

$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'fountain'
Expand Down

0 comments on commit 1a7fd4e

Please sign in to comment.