spec/rest/settings/tracking_spec.rb in sendgrid4r-1.11.0 vs spec/rest/settings/tracking_spec.rb in sendgrid4r-1.12.0

- old
+ new

@@ -89,15 +89,13 @@ let(:client) do SendGrid4r::Client.new(api_key: '') end let(:click) do - JSON.parse( - '{'\ - '"enabled": true'\ - '}' - ) + '{'\ + '"enabled": true'\ + '}' end it '#get_settings_click' do allow(client).to receive(:execute).and_return(click) actual = client.get_settings_click @@ -109,25 +107,23 @@ actual = client.patch_settings_click(params: nil) expect(actual).to be_a(Tracking::Click) end it 'creates click instance' do - actual = Tracking.create_click(click) + actual = Tracking.create_click(JSON.parse(click)) expect(actual.enabled).to eq(true) end let(:google_analytics) do - JSON.parse( - '{'\ - '"enabled": true,'\ - '"utm_source": "sendgrid.com",'\ - '"utm_medium": "email",'\ - '"utm_term": "",'\ - '"utm_content": "",'\ - '"utm_campaign": "website"'\ - '}' - ) + '{'\ + '"enabled": true,'\ + '"utm_source": "sendgrid.com",'\ + '"utm_medium": "email",'\ + '"utm_term": "",'\ + '"utm_content": "",'\ + '"utm_campaign": "website"'\ + '}' end it '#get_settings_google_analytics' do allow(client).to receive(:execute).and_return(google_analytics) actual = client.get_settings_google_analytics @@ -139,25 +135,23 @@ actual = client.patch_settings_google_analytics(params: nil) expect(actual).to be_a(Tracking::GoogleAnalytics) end it 'creates google_analytics instance' do - actual = Tracking.create_google_analytics(google_analytics) + actual = Tracking.create_google_analytics(JSON.parse(google_analytics)) expect(actual.enabled).to eq(true) expect(actual.utm_source).to eq('sendgrid.com') expect(actual.utm_medium).to eq('email') expect(actual.utm_term).to eq('') expect(actual.utm_content).to eq('') expect(actual.utm_campaign).to eq('website') end let(:open) do - JSON.parse( - '{'\ - '"enabled": true'\ - '}' - ) + '{'\ + '"enabled": true'\ + '}' end it '#get_settings_open' do allow(client).to receive(:execute).and_return(open) actual = client.get_settings_open @@ -169,25 +163,23 @@ actual = client.patch_settings_open(params: nil) expect(actual).to be_a(Tracking::Open) end it 'creates open instance' do - actual = Tracking.create_open(open) + actual = Tracking.create_open(JSON.parse(open)) expect(actual.enabled).to eq(true) end let(:subscription) do - JSON.parse( - '{'\ - '"enabled": true,'\ - '"landing": "landing page html",'\ - '"url": "url",'\ - '"replace": "replacement tag",'\ - '"html_content": "html content",'\ - '"plain_content": "text content"'\ - '}' - ) + '{'\ + '"enabled": true,'\ + '"landing": "landing page html",'\ + '"url": "url",'\ + '"replace": "replacement tag",'\ + '"html_content": "html content",'\ + '"plain_content": "text content"'\ + '}' end it '#get_settings_subscription' do allow(client).to receive(:execute).and_return(subscription) actual = client.get_settings_subscription @@ -199,10 +191,10 @@ actual = client.patch_settings_subscription(params: nil) expect(actual).to be_a(Tracking::Subscription) end it 'creates subscription instance' do - actual = Tracking.create_subscription(subscription) + actual = Tracking.create_subscription(JSON.parse(subscription)) expect(actual.enabled).to eq(true) expect(actual.landing).to eq('landing page html') expect(actual.url).to eq('url') expect(actual.replace).to eq('replacement tag') expect(actual.html_content).to eq('html content')