Sha256: 7cc595b8eb7b2eecf2c6ad55ac57d8d8aaec3ae9d0fa7655610059110d3e15e9

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

require 'helper'

describe Feedlr::Mapper do
  describe 'Mapper.build' do
    it 'returns Feedlr::Base object when the input is a non empty hash' do
      obj = { a: 1 , b: 2 }
      expect(Feedlr::Mapper.build(obj)).to eq(Feedlr::Base.new(obj))
    end
    it 'returns Feedlr::Collection object when the input is an array' do
      obj = [{ a: 1 , b: 2 } , { c: 3 ,  d: 4 }]
      expect(Feedlr::Mapper.build(obj)).to eq(Feedlr::Collection.new(obj))
    end

    it 'returns Feedlr::Success object if input is an empty hash' do
      obj = {}
      expect(Feedlr::Mapper.build(obj)).to eq(Feedlr::Success.new)
    end

    it "returns Feedlr::Success object if input is not \
    Hash with content or Array" do
      obj = 5
      expect(Feedlr::Mapper.build(obj)).to eq(Feedlr::Success.new)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feedlr-0.1.0 spec/feedly/mapper_spec.rb