Sha256: a434baadc2f18ceb997b031b7b62baf75d303906c1ee4c726c3d113805a082d0

Contents?: true

Size: 932 Bytes

Versions: 4

Compression:

Stored size: 932 Bytes

Contents

FactoryGirl.define do
  factory :listing, :class => MLS::Listing do
    before(:create) { |l|
      MLS_GEM_CACHE['auth_key'] = MLS.auth_key
      MLS.auth_key = l.account.auth_key
    }
    after(:create) { |l|
      MLS.auth_key = MLS_GEM_CACHE['auth_key']
    }

    association :account
    association :address, :strategy => :build

    agents  { [FactoryGirl.attributes_for(:agent)] }

    use 'Office'
    size { Kernel.rand(3000..900000) }
    maximum_contiguous_size { Kernel.rand(3000..900000) }
    minimum_divisible_size { Kernel.rand(3000..900000) }
    type 'lease'
    #lease_terms { ::MLS::Listing::LEASE_TERMS.sample }
    space_type 'unit'
    rate { rand(15..300) }
    available_on { Time.now + (20 + rand(0..360).to_i).days }
    sublease_expiration { |l| l.sublease? ? (l.available_on + (30 + Kernel.rand(10..360)).days) : nil }
    name { |l| l.type == 'coworking_space' ? Faker::Name.name : nil }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mls-0.11.3 lib/mls/factories/listing.rb
mls-0.11.2 lib/mls/factories/listing.rb
mls-0.11.1 lib/mls/factories/listing.rb
mls-0.11.0 lib/mls/factories/listing.rb