Sha256: 397aa8e5d107e03728a56475fd303bf1419ae1d2236312363e734cc06c46af33

Contents?: true

Size: 1.58 KB

Versions: 14

Compression:

Stored size: 1.58 KB

Contents

require 'helper'

describe Desk::Client do
  context "Inbound Mailbox" do

    let(:endpoint) { "inbound_mailbox" }
    let(:id) { 1 }
    let(:check_key) { "name" }
    let(:check_value) { "Support Mailbox" }

    include_context "basic configuration"

    context "list all inbound mailboxes" do

      include_context "plural endpoint"

      subject { client.send("list_#{endpoints}") }

      before do
        stub_get("mailboxes/inbound").to_return(:body => fixture(endpoints))
      end

      it "gets the correct resource" do
        subject
        expect(a_get("mailboxes/inbound")).to have_been_made
      end

      it { expect(subject).to be_a Hashie::Deash }

      it "has valid entries" do
        expect(subject.first.id).to eq(id)
        expect(subject.first.send(check_key)).to eq(check_value)
      end

      it "allows raw access" do
        expect(subject.raw.first).to be_a Array
      end

    end

    context "retrieve a single inbound mailbox" do

      include_context "plural endpoint"

      subject { client.send("show_#{endpoint}", id) }

      before do
        stub_get("mailboxes/inbound/#{id}").to_return(:body => fixture(endpoint))
      end

      it "gets the correct resource" do
        subject
        expect(a_get("mailboxes/inbound/#{id}")).to have_been_made
      end

      it { expect(subject).to be_a Hashie::Deash }

      it "has a valid entry" do
        expect(subject.id).to eq(id)
        expect(subject.send(check_key)).to eq(check_value)
      end

      it "allows raw access" do
        expect(subject.raw).to be_a Hashie::Deash
      end

    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
desk-1.2.0 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.1.1 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.1.0 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.10 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.9 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.8 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.7 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.6 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.5 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.4 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.3 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.2 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.1 spec/desk/client/inbound_mailboxes_spec.rb
desk-1.0.0 spec/desk/client/inbound_mailboxes_spec.rb