Sha256: f1a98096684c9b33157209867730fef82c2f40e0ae7254a9503cf77b78ec9b94

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require 'hashie'
require 'faker'

FactoryGirl.define do

  # Notice that in factory I didn't care about total contacts in levels +
  # departments = totalCount
  factory :data_com_company_contact_count_response, class: Hashie::Mash do
    id          { Faker::Number.number(6).to_i }
    totalCount  { Faker::Number.number(2).to_i }
    url         { Faker::Internet.url          }
    levels      nil
    departments nil

    ignore do
      levels_size      5
      departments_size 9
    end

    initialize_with { new(attributes) }

    after(:build) do |data_com_company_contact_count_response, evaluator|
      unless data_com_company_contact_count_response[:levels]
        data_com_company_contact_count_response[:levels] = FactoryGirl.build_list(
          :data_com_company_contact_count_level,
          evaluator.levels_size
        )
      end

      unless data_com_company_contact_count_response[:departments]
        data_com_company_contact_count_response[:departments] = FactoryGirl.build_list(
          :data_com_company_contact_count_department,
          evaluator.departments_size
        )
      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/company_contact_count_response_factory.rb
data-com-api-0.2.0 spec/factories/data-com/company_contact_count_response_factory.rb
data-com-api-0.1.5 spec/factories/data-com/company_contact_count_response_factory.rb
data-com-api-0.1.4 spec/factories/data-com/company_contact_count_response_factory.rb
data-com-api-0.1.3 spec/factories/data-com/company_contact_count_response_factory.rb
data-com-api-0.1.2 spec/factories/data-com/company_contact_count_response_factory.rb
data-com-api-0.1.1 spec/factories/data-com/company_contact_count_response_factory.rb
data-com-api-0.1.0 spec/factories/data-com/company_contact_count_response_factory.rb