File tree Expand file tree Collapse file tree
spec/controllers/marketing_redesign Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments