spec/rest/sm/suppressions_spec.rb in sendgrid4r-1.11.0 vs spec/rest/sm/suppressions_spec.rb in sendgrid4r-1.12.0
- old
+ new
@@ -78,64 +78,54 @@
let(:client) do
SendGrid4r::Client.new(api_key: '')
end
let(:recipient_emails) do
- JSON.parse(
- '{'\
- '"recipient_emails": ['\
- '"test1@example.com",'\
- '"test2@example.com"'\
- ']'\
- '}'
- )
+ '{'\
+ '"recipient_emails": ['\
+ '"test1@example.com",'\
+ '"test2@example.com"'\
+ ']'\
+ '}'
end
let(:recipient_email) do
- JSON.parse(
- '{'\
- '"recipient_email": "test1@example.com"'\
- '}'
- )
+ '{'\
+ '"recipient_email": "test1@example.com"'\
+ '}'
end
let(:emails) do
- JSON.parse(
- '["test1@example.com","test2@example.com"]'
- )
+ '["test1@example.com","test2@example.com"]'
end
let(:suppression) do
- JSON.parse(
- '{'\
- '"id": 4,'\
- '"name": "Special Offers",'\
- '"description": "Special offers and coupons",'\
- '"suppressed": false'\
- '}'
- )
+ '{'\
+ '"id": 4,'\
+ '"name": "Special Offers",'\
+ '"description": "Special offers and coupons",'\
+ '"suppressed": false'\
+ '}'
end
let(:suppressions) do
- JSON.parse(
- '{'\
- '"suppressions": ['\
- '{'\
- '"id": 1,'\
- '"name": "Weekly Newsletter",'\
- '"description": "The weekly newsletter",'\
- '"suppressed": false'\
- '},'\
- '{'\
- '"id": 4,'\
- '"name": "Special Offers",'\
- '"description": "Special offers and coupons",'\
- '"suppressed": false'\
- '}'\
- ']'\
- '}'
- )
+ '{'\
+ '"suppressions": ['\
+ '{'\
+ '"id": 1,'\
+ '"name": "Weekly Newsletter",'\
+ '"description": "The weekly newsletter",'\
+ '"suppressed": false'\
+ '},'\
+ '{'\
+ '"id": 4,'\
+ '"name": "Special Offers",'\
+ '"description": "Special offers and coupons",'\
+ '"suppressed": false'\
+ '}'\
+ ']'\
+ '}'
end
it '#post_suppressed_emails' do
allow(client).to receive(:execute).and_return(recipient_emails)
actual = client.post_suppressed_emails(
@@ -164,19 +154,19 @@
actual = client.delete_suppressed_email(group_id: 0, email_address: '')
expect(actual).to eq('')
end
it 'creates suppression instance' do
- actual = Suppressions.create_suppression(suppression)
+ actual = Suppressions.create_suppression(JSON.parse(suppression))
expect(actual).to be_a(Suppressions::Suppression)
expect(actual.id).to eq(4)
expect(actual.name).to eq('Special Offers')
expect(actual.description).to eq('Special offers and coupons')
expect(actual.suppressed).to eq(false)
end
it 'creates suppressions instance' do
- actual = Suppressions.create_suppressions(suppressions)
+ actual = Suppressions.create_suppressions(JSON.parse(suppressions))
expect(actual).to be_a(Suppressions::Suppressions)
expect(actual.suppressions).to be_a(Array)
actual.suppressions.each do |suppression|
expect(suppression).to be_a(Suppressions::Suppression)
end