Sha256: ab7bdcf054118f52db1819bf2415476ab1f83f65128dc537578b8d0a1a3f5bf8

Contents?: true

Size: 1.88 KB

Versions: 13

Compression:

Stored size: 1.88 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

    it "passes opts to its API handle" do
      api = ContextIO.new('1234', '0987', {a:'b'}).api
      expect(api.opts).to eq(a:'b')
    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

13 entries across 13 versions & 1 rubygems

Version Path
contextio-1.7.2 spec/unit/contextio_spec.rb
contextio-1.7.1 spec/unit/contextio_spec.rb
contextio-1.7.0 spec/unit/contextio_spec.rb
contextio-1.6.0 spec/unit/contextio_spec.rb
contextio-1.5.0 spec/unit/contextio_spec.rb
contextio-1.4.0 spec/unit/contextio_spec.rb
contextio-1.3.0 spec/unit/contextio_spec.rb
contextio-1.2.4 spec/unit/contextio_spec.rb
contextio-1.2.3 spec/contextio_spec.rb
contextio-1.2.2 spec/contextio_spec.rb
contextio-1.2.1 spec/contextio_spec.rb
contextio-1.2.0 spec/contextio_spec.rb
contextio-1.1.0 spec/contextio_spec.rb