Fix rubocop complaints
This commit is contained in:
parent
4db96208e8
commit
59908e60e4
1 changed files with 9 additions and 8 deletions
17
spec/helpers/external/mailbluster_helper_spec.rb
vendored
17
spec/helpers/external/mailbluster_helper_spec.rb
vendored
|
|
@ -3,11 +3,11 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'webmock/rspec'
|
require 'webmock/rspec'
|
||||||
|
|
||||||
describe External::MailblusterHelper, type: :helper do
|
describe External::MailblusterHelper, type: :helper do
|
||||||
let!(:user) { create(:user) }
|
let!(:user) { create(:user) }
|
||||||
|
|
||||||
describe 'create_lead' do
|
describe 'create_lead' do
|
||||||
it 'makes a post request to Mailbluster\'s API' do
|
it 'makes a post request to Mailbluster\'s API and gets the correct response' do
|
||||||
response_body = "{
|
response_body = "{
|
||||||
\"message\": \"Lead created\",
|
\"message\": \"Lead created\",
|
||||||
\"lead\": {
|
\"lead\": {
|
||||||
|
|
@ -22,15 +22,16 @@ describe External::MailblusterHelper, type: :helper do
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
stub_request(:post, "http://api.mailbluster.com/api/leads")
|
stub_request(:post, 'https://api.mailbluster.com/api/leads')
|
||||||
.to_return(body: response_body, status: 200)
|
.to_return(body: response_body, status: 200)
|
||||||
response = create_lead(user)
|
response = create_lead(user)
|
||||||
expect(WebMock).to have_requested(:post, "api.mailbluster.com/api/leads").with(body: {
|
|
||||||
'email': user.email,
|
expect(WebMock).to have_requested(:post, 'api.mailbluster.com/api/leads').with(body: {
|
||||||
'firstName': user.name,
|
'email': user.email,
|
||||||
|
'firstName': user.name,
|
||||||
'overrideExisting': true,
|
'overrideExisting': true,
|
||||||
'subscribed': true,
|
'subscribed': true,
|
||||||
'tags': ["snapcon"],
|
'tags': ['snapcon']
|
||||||
}.to_json)
|
}.to_json)
|
||||||
expect(response).to eq(response_body)
|
expect(response).to eq(response_body)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue