Sha256: 0cfd831e9afe7bcfb558c66e142a39c0612b2914417f652be9ee4e385dff4e86

Contents?: true

Size: 620 Bytes

Versions: 5

Compression:

Stored size: 620 Bytes

Contents

require 'spec_helper'

describe ButterCMS do
  describe '.request' do
    context 'with an api token' do
      before do
        ButterCMS.stub(:api_token).and_return('test123')
      end

      it 'should make an api request' do
        stub_request(:get, 'https://api.buttercms.com/v2?auth_token=test123').to_return(body: JSON.generate({data: {test: 'test'}}))
        expect{ ButterCMS.request('') }.to_not raise_error
      end
    end

    context 'without an api token' do
      it 'should throw an argument error' do
        expect{ ButterCMS.request() }.to raise_error(ArgumentError)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
buttercms-ruby-1.2.0 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.1.3 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.1.2 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.1.1 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.1.0 spec/lib/butter-ruby_spec.rb