Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Applicants#advance_applicant to support funnel_id #10

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading