Sha256: f7cf293151534ed64c357b118343b363fddd0b9d70aba54cd4aefe1c6ade29fc

Contents?: true

Size: 921 Bytes

Versions: 4

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper.rb'

describe Reviewed::Utils do

  class MockUtils < Reviewed::Base; end

  describe 'object_from_response' do
    use_vcr_cassette "utils/object"

    let(:article_id) { '509d166d60de7db97c05ce71' }

    it 'returns an object of the correct class' do
      response = MockUtils.object_from_response(:get, "articles/#{article_id}")
      response.should be_an_instance_of(MockUtils)
    end
  end

  describe 'collection_from_response' do
    use_vcr_cassette "utils/collection"

    it 'returns a collection object' do
      collection = MockUtils.collection_from_response(:get, "articles")
      collection.should be_an_instance_of(Reviewed::Collection)
    end

    it 'returns objects of the correct class' do
      collection = MockUtils.collection_from_response(:get, "articles")
      collection.items.each do |obj|
        obj.should be_an_instance_of(MockUtils)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reviewed-0.1.2 spec/utils_spec.rb
reviewed-0.1.1 spec/utils_spec.rb
reviewed-0.1.0 spec/utils_spec.rb
reviewed-0.0.9 spec/utils_spec.rb