Sha256: 0ac639c7617f1c33a573fcaf961f04023a755b8b9a6619b4d532ab291d8136cd

Contents?: true

Size: 787 Bytes

Versions: 16

Compression:

Stored size: 787 Bytes

Contents

require 'spec_helper'

describe ButterCMS::Content do
  before do
    allow(ButterCMS).to receive(:token).and_return('test123')
    allow(ButterCMS).to receive(:request).and_return({
      "meta"=>{
        "next_page"=>2, 
        "previous_page"=>nil, 
        "count"=>2
        }, 
      "data"=>{
        "author"=>[
          { "name"=>"Charles Dickens"},
          { "name"=>"J.K. Rowling"}
        ]
      }
    })
    
    @response = ButterCMS::Content.list('slug', {
      page: 1,
      page_size: 2
    })
  end
  
  it "has meta and collection info" do
    expect(@response.meta.next_page).to eq(2)
    expect(@response.to_a.first.data.first).to eq('author')
    expect(@response.to_a.first.data.last.first).to have_attributes(
      name: "Charles Dickens"
    )
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
buttercms-ruby-zwg-2.5.7 spec/lib/buttercms/content_spec.rb
buttercms-ruby-zwg-2.5.2 spec/lib/buttercms/content_spec.rb
buttercms-ruby-zwg-2.5.3 spec/lib/buttercms/content_spec.rb
buttercms-ruby-zwg-2.4.2 spec/lib/buttercms/content_spec.rb
buttercms-ruby-zwg-2.4.1 spec/lib/buttercms/content_spec.rb
zuzanky-buttercms-ruby-2.4 spec/lib/buttercms/content_spec.rb
buttercms-ruby-2.4 spec/lib/buttercms/content_spec.rb
buttercms-ruby-2.3 spec/lib/buttercms/content_spec.rb
buttercms-ruby-2.2 spec/lib/buttercms/content_spec.rb
buttercms-ruby-2.1 spec/lib/buttercms/content_spec.rb
buttercms-ruby-2.0 spec/lib/buttercms/content_spec.rb
buttercms-ruby-1.9 spec/lib/buttercms/content_spec.rb
buttercms-ruby-1.8 spec/lib/buttercms/content_spec.rb
buttercms-ruby-1.7 spec/lib/buttercms/content_spec.rb
buttercms-ruby-1.6 spec/lib/buttercms/content_spec.rb
buttercms-ruby-1.5 spec/lib/buttercms/content_spec.rb