Sha256: 8365f11e477cd92013d2e891f2920227e7905e2c19d50ad3074a0906b97a0758

Contents?: true

Size: 942 Bytes

Versions: 39

Compression:

Stored size: 942 Bytes

Contents

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

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

    #agents_attributes  { {'0' => FactoryGirl.attributes_for(:broker)} }

    use 'Office'
    total_size { Kernel.rand(3000..900000) }
    maximum_contiguous_size { Kernel.rand(3000..900000) }
    minimum_divisable_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

39 entries across 39 versions & 1 rubygems

Version Path
mls-0.2.54 test/factories/listing.rb
mls-0.2.53 test/factories/listing.rb
mls-0.2.52 test/factories/listing.rb
mls-0.2.51 test/factories/listing.rb
mls-0.2.50 test/factories/listing.rb
mls-0.2.49 test/factories/listing.rb
mls-0.2.48 test/factories/listing.rb
mls-0.2.47 test/factories/listing.rb
mls-0.2.46 test/factories/listing.rb
mls-0.2.45 test/factories/listing.rb
mls-0.2.44 test/factories/listing.rb
mls-0.2.43 test/factories/listing.rb
mls-0.2.42 test/factories/listing.rb
mls-0.2.41 test/factories/listing.rb
mls-0.2.40 test/factories/listing.rb
mls-0.2.39 test/factories/listing.rb
mls-0.2.38 test/factories/listing.rb
mls-0.2.37 test/factories/listing.rb
mls-0.2.36 test/factories/listing.rb
mls-0.2.35 test/factories/listing.rb