Sha256: 05a14027ec27ffe3e803a47e94fe7c433a6207771871fc62625a9909d8f92623

Contents?: true

Size: 990 Bytes

Versions: 4

Compression:

Stored size: 990 Bytes

Contents

require 'spec_helper'
require 'chatwork'

describe ChatWork do
  describe '#client' do
    subject { super().client }
    it { should be_a(ChatWork::Client) }
  end

  describe '#api_base' do
    subject { super().api_base }
    it { should eq('https://api.chatwork.com/') }
  end
  describe '#api_base=' do
    before { ChatWork.api_base = 'https://test.example.com/' }

    describe '#api_base' do
      subject { super().api_base }
      it { should eq('https://test.example.com/') }
    end

    describe '#api_base' do
      subject { super().api_base }
      it { should eq('https://test.example.com/') }
    end
  end

  describe '#api_key' do
    context 'when does not set env' do
      subject { super().api_key }
      it { should be_nil }
    end

    context 'when sets env' do
      let(:test_token) { 'chatwork_test_token' }
      before { ENV['CHATWORK_API_TOKEN'] = test_token }
      subject { super().api_key }
      it { is_expected.to eq test_token }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chatwork-0.4.1 spec/lib/chatwork_spec.rb
chatwork-0.4.0 spec/lib/chatwork_spec.rb
chatwork-0.3.1 spec/lib/chatwork_spec.rb
chatwork-0.3.0 spec/lib/chatwork_spec.rb