Sha256: 996766638c7a513ff0c5b987518df383c90f3624cb8fe5d73d96b114cadd9318

Contents?: true

Size: 799 Bytes

Versions: 8

Compression:

Stored size: 799 Bytes

Contents

require 'hashie'
require 'faker'
require 'active_support/hash_with_indifferent_access'
require 'data-com-api/client'

FactoryGirl.define do

  factory :data_com_search_contact_response, class: Hashie::Mash do
    totalHits 0
    contacts  nil

    ignore do
      page_size 3
    end

    initialize_with { new(attributes) }

    after(:build) do |data_com_search_contact_response, evaluator|
      if evaluator.page_size > 0 && data_com_search_contact_response[:contacts].nil?
        data_com_search_contact_response[:contacts] = FactoryGirl.build_list(
          :data_com_contact,
          evaluator.page_size
        )
      elsif evaluator.page_size == 0 && data_com_search_contact_response[:contacts].nil?
        data_com_search_contact_response[:contacts] = []
      end
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
data-com-api-0.2.1 spec/factories/data-com/search_contact_response_factory.rb
data-com-api-0.2.0 spec/factories/data-com/search_contact_response_factory.rb
data-com-api-0.1.5 spec/factories/data-com/search_contact_response_factory.rb
data-com-api-0.1.4 spec/factories/data-com/search_contact_response_factory.rb
data-com-api-0.1.3 spec/factories/data-com/search_contact_response_factory.rb
data-com-api-0.1.2 spec/factories/data-com/search_contact_response_factory.rb
data-com-api-0.1.1 spec/factories/data-com/search_contact_response_factory.rb
data-com-api-0.1.0 spec/factories/data-com/search_contact_response_factory.rb