Sha256: d6ccd6ffb5f6c81e17698462d3c2fe594920a62427e7da828148b6ab2463ce8a
Contents?: true
Size: 1.59 KB
Versions: 5
Compression:
Stored size: 1.59 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe ActionKitRest::Response::ValidationError do describe '#to_s' do subject { ActionKitRest::Response::ValidationError.new(url: url, body: body) } context 'with a normal URL and body' do let(:url) { 'https://actionkit.example.com/rest/v1/page/1' } let(:errors) { { 'zip' => 'invalid zip code' } } let(:body) { { errors: errors }.to_json } it 'should put information in the string' do expect(subject.to_s).to eq "ActionKitRest::Response::ValidationError \n url: #{url} \n body: #{body} \n errors: #{errors.inspect}" end end context 'with special characters in the body' do let(:url) { 'https://actionkit.example.com/rest/v1/page/1' } let(:errors) { { 'zip' => '☃' } } let(:body) { { errors: errors }.to_json } it 'should put information in the string' do expect(subject.to_s).to eq "ActionKitRest::Response::ValidationError \n url: #{url} \n body: #{body} \n errors: #{errors.inspect}" end end context 'with a body in ASCII-8BIT format' do let(:url) { 'https://actionkit.example.com/rest/v1/page/1' } let(:errors) { {'mailing_id' => ['לא הצלחנו לקשר בין מספר הזיהוי של רשימת הדיוור הזו לבין החשבון.']} } let(:body) { { errors: errors }.to_json.b } it 'should put information in the string' do expect(subject.to_s).to eq "ActionKitRest::Response::ValidationError \n url: #{url} \n body: {\"errors\":#{errors.to_json}} \n errors: #{errors.inspect}" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems