Skip to content

Commit c40c427

Browse files
Add imssing specs for marketing redesign opportunity creation form
1 parent ab0ea71 commit c40c427

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
require "rails_helper"
2+
3+
describe MarketingRedesign::OpportunitiesController do
4+
around do |example|
5+
ClimateControl.modify(ENABLE_MARKETING_REDESIGN: "true") do
6+
Rails.application.reload_routes!
7+
example.run
8+
end
9+
ensure
10+
Rails.application.reload_routes!
11+
end
12+
13+
describe "#create" do
14+
it "calls the Hub API opportunities creation endpoint with the correct parameters" do
15+
allow(Hub::Opportunities).to receive(:create)
16+
17+
post(
18+
:create,
19+
params: {
20+
opportunity: {
21+
contact_first_name: "Firstname",
22+
contact_last_name: "Lastname",
23+
email: "example@example.com",
24+
company_name: "Example Company",
25+
contact_job_title: "Example Job Title"
26+
}
27+
}
28+
)
29+
30+
expect(Hub::Opportunities).to(
31+
have_received(:create).with({
32+
"contact_name" => "Firstname Lastname",
33+
"email" => "example@example.com",
34+
"company_name" => "Example Company",
35+
"contact_job_title" => "Example Job Title",
36+
:conversion_point => be_present,
37+
:project_type => be_present
38+
})
39+
)
40+
end
41+
end
42+
end

0 commit comments

Comments
 (0)