Sha256: 3586cde84367113779e8ff8433bd1ed069e3adbd4c0239e7bed78553456a6107

Contents?: true

Size: 585 Bytes

Versions: 11

Compression:

Stored size: 585 Bytes

Contents

require 'spec_helper'

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

      it 'should make an api request' do
        stub_request(:get, ButterCMS.endpoint).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

11 entries across 11 versions & 1 rubygems

Version Path
buttercms-ruby-1.0.10 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.9 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.8 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.7 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.6 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.5 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.4 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.3 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.2 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.1 spec/lib/butter-ruby_spec.rb
buttercms-ruby-1.0.0 spec/lib/butter-ruby_spec.rb