Sha256: 592f367a69b6801de415fe93ec504ef071b23c8af18eafb14a7b5d4ac7150f87

Contents?: true

Size: 936 Bytes

Versions: 42

Compression:

Stored size: 936 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'
    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

42 entries across 42 versions & 1 rubygems

Version Path
mls-0.9.9 test/factories/listing.rb
mls-0.9.8 test/factories/listing.rb
mls-0.9.6 test/factories/listing.rb
mls-0.9.5 test/factories/listing.rb
mls-0.9.4 test/factories/listing.rb
mls-0.9.3 test/factories/listing.rb
mls-0.9.2 test/factories/listing.rb
mls-0.9.1 test/factories/listing.rb
mls-0.9.0 test/factories/listing.rb
mls-0.8.2 test/factories/listing.rb
mls-0.8.1 test/factories/listing.rb
mls-0.8.0 test/factories/listing.rb
mls-0.7.2 test/factories/listing.rb
mls-0.7.1 test/factories/listing.rb
mls-0.7.0 test/factories/listing.rb
mls-0.6.7 test/factories/listing.rb
mls-0.6.6 test/factories/listing.rb
mls-0.6.5 test/factories/listing.rb
mls-0.6.4 test/factories/listing.rb
mls-0.6.3 test/factories/listing.rb