Sha256: e6d1b4cdbc869271a2ff63a5084122af9eff9e494878c4196357af84df154ff9

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

# encoding: utf-8
require File.dirname(__FILE__) + '/../../spec_helper'

module SendGrid4r::REST::Settings
  describe SendGrid4r::REST::Settings do
    describe 'unit test', :ut do
      let(:client) do
        SendGrid4r::Client.new(api_key: '')
      end

      let(:results) do
        '{'\
          '"result": ['\
            '{'\
              '"name": "bcc",'\
              '"title": "BCC",'\
              '"description": "lorem ipsum... .",'\
              '"enabled": true'\
            '}'\
          ']'\
        '}'
      end

      let(:result) do
        '{'\
          '"name": "bcc",'\
          '"title": "BCC",'\
          '"description": "lorem ipsum... .",'\
          '"enabled": true'\
        '}'
      end

      it 'creates results instance' do
        actual = SendGrid4r::REST::Settings.create_results(JSON.parse(results))
        expect(actual.result).to be_a(Array)
        actual.result.each do |result|
          expect(result).to be_a(Result)
        end
      end

      it 'creates result instance' do
        actual = SendGrid4r::REST::Settings.create_result(JSON.parse(result))
        expect(actual).to be_a(Result)
        expect(actual.name).to eq('bcc')
        expect(actual.title).to eq('BCC')
        expect(actual.description).to eq('lorem ipsum... .')
        expect(actual.enabled).to eq(true)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sendgrid4r-1.15.0 spec/rest/settings/settings_spec.rb
sendgrid4r-1.14.0 spec/rest/settings/settings_spec.rb
sendgrid4r-1.13.0 spec/rest/settings/settings_spec.rb
sendgrid4r-1.12.0 spec/rest/settings/settings_spec.rb