Sha256: 5308abb27dfd5a41cb10ba7969cd804a40f0c9e053a625d77a373942fabfd1b3
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
require 'spec_helper' describe ButterCMS::ButterResource do before do allow(ButterCMS).to receive(:token).and_return('test123') allow(ButterCMS).to receive(:request).and_return({"data" => [{"attribute" => 'test'}]}) allow(ButterCMS::ButterResource).to receive(:resource_path).and_return('') end describe '.all' do it 'should make a request with the correct endpoint' do expect(ButterCMS).to receive(:request).with('', {}) ButterCMS::ButterResource.all() end it 'should return a collection' do objects = ButterCMS::ButterResource.all expect(objects).to be_a(ButterCMS::ButterCollection) expect(objects.first).to be_a(ButterCMS::ButterResource) end end describe '.find' do it 'should make a request with the correct endpoint' do expect(ButterCMS).to receive(:request).with('1/', {}) ButterCMS::ButterResource.find(1) end it 'should return one object' do expect(ButterCMS::ButterResource.find(1)).to be_a(ButterCMS::ButterResource) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
buttercms-ruby-1.6 | spec/lib/buttercms/butter_resource_spec.rb |
buttercms-ruby-1.5 | spec/lib/buttercms/butter_resource_spec.rb |