Sha256: a9e0905a5222cbcb45e46ad78799320ab3fd18c86e0089ca2806459a659d7c23

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

require 'spec_helper'
require 'contextio'

describe ContextIO do
  subject { ContextIO.new(nil, nil) }

  describe ".new" do
    it "creates a new API handle" do
      expect(ContextIO.new(nil, nil).api).to be_a(ContextIO::API)
    end

    it "passes credentials to its API handle" do
      api = ContextIO.new('1234', '0987').api
      expect(api.key).to eq('1234')
      expect(api.secret).to eq('0987')
    end
  end

  describe "#oauth_providers" do
    it "returns a new OAuthProviderCollection" do
      expect(subject.oauth_providers).to be_a(ContextIO::OAuthProviderCollection)
    end

    it "passes its API handle to the OAuthProviderCollection" do
      expect(subject.oauth_providers.api).to eq(subject.api)
    end
  end

  describe "#accounts" do
    it "returns a new AccountCollection" do
      expect(subject.accounts).to be_a(ContextIO::AccountCollection)
    end

    it "passes its API handle to the AccountCollection" do
      expect(subject.accounts.api).to eq(subject.api)
    end
  end

  describe "#connect_tokens" do
    it "returns a new ConnectTokenCollection" do
      expect(subject.connect_tokens).to be_a(ContextIO::ConnectTokenCollection)
    end

    it "passes its API handle to the ConnectTokenCollection" do
      expect(subject.connect_tokens.api).to eq(subject.api)
    end
  end

  describe "#email_settings_for" do
    subject { ContextIO.new(nil, nil).email_settings_for('email@address.com') }

    it "returns a new EmailSettings" do
      expect(subject).to be_a(ContextIO::EmailSettings)
    end

    it "passes its API handle to the EmailSettings" do
      expect(subject.api).to eq(subject.api)
    end

    it "passes the email address to the EmailSettings" do
      expect(subject.email).to eq('email@address.com')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contextio-1.0.1 spec/contextio_spec.rb
contextio-1.0.0 spec/contextio_spec.rb