Sha256: 69f40cd311d6d8d62f07c153bc8f13bd26d6073521e4468867fbd2180e5b9122

Contents?: true

Size: 1.65 KB

Versions: 22

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'

describe GroupDocs do

  subject { described_class }
  let(:client_id)   { '07aaaf95f8eb33a4' }
  let(:private_key) { '5cb711b3a52ffc5d90ee8a0f79206f5a' }

  describe '.configure' do
    it { should respond_to(:configure) }

    it 'calls block for self' do
      subject.should_receive(:configure).and_yield(subject)
      subject.configure do |api|
        api.client_id   = client_id
        api.private_key = private_key
      end
    end

    it 'saves client ID for further access' do
      subject.should_receive(:client_id=).with(client_id).and_return(client_id)
      subject.configure do |api|
        api.client_id = client_id
      end
      subject.client_id.should == client_id
    end

    it 'saves private key for further access' do
      subject.should_receive(:private_key=).with(private_key).and_return(private_key)
      subject.configure do |api|
        api.private_key = private_key
      end
      subject.private_key.should == private_key
    end
  end

  it { should respond_to(:client_id)    }
  it { should respond_to(:client_id=)   }
  it { should respond_to(:private_key)  }
  it { should respond_to(:private_key=) }
  it { should respond_to(:api_server)   }
  it { should respond_to(:api_server=)  }
  it { should respond_to(:api_version)  }
  it { should respond_to(:api_version=) }

  describe '#api_server' do
    it 'returns default URL if it has not been overwritten' do
      subject.api_server.should == 'https://api.groupdocs.com'
    end

    it 'returns custom overwritten URL' do
      subject.api_server = 'https://dev-api.groupdocs.com'
      subject.api_server.should == 'https://dev-api.groupdocs.com'
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
groupdocs-0.3.11 spec/groupdocs_spec.rb
groupdocs-0.3.10 spec/groupdocs_spec.rb
groupdocs-0.3.9 spec/groupdocs_spec.rb
groupdocs-0.3.8 spec/groupdocs_spec.rb
groupdocs-0.3.7 spec/groupdocs_spec.rb
groupdocs-0.3.6 spec/groupdocs_spec.rb
groupdocs-0.3.5 spec/groupdocs_spec.rb
groupdocs-0.3.0 spec/groupdocs_spec.rb
groupdocs-0.2.11 spec/groupdocs_spec.rb
groupdocs-0.2.10 spec/groupdocs_spec.rb
groupdocs-0.2.9 spec/groupdocs_spec.rb
groupdocs-0.2.8 spec/groupdocs_spec.rb
groupdocs-0.2.7 spec/groupdocs_spec.rb
groupdocs-0.2.6 spec/groupdocs_spec.rb
groupdocs-0.2.5 spec/groupdocs_spec.rb
groupdocs-0.2.4 spec/groupdocs_spec.rb
groupdocs-0.2.3 spec/groupdocs_spec.rb
groupdocs-0.2.2 spec/groupdocs_spec.rb
groupdocs-0.2.1 spec/groupdocs_spec.rb
groupdocs-0.2 spec/groupdocs_spec.rb