Upgrade to rails 4.1

This commit is contained in:
wvengen 2014-11-21 14:37:56 +01:00
parent 6188567931
commit 6e990fed4c
23 changed files with 179 additions and 197 deletions

View file

@ -2,15 +2,24 @@ require 'factory_girl'
FactoryGirl.define do
factory :article do
sequence(:name) { |n| Faker::Lorem.words(rand(2..4)).join(' ') + " ##{n}" }
factory :_article do
unit { Faker::Unit.unit }
price { rand(2600) / 100 }
tax { [6, 21].sample }
deposit { rand(10) < 8 ? 0 : [0.0, 0.80, 1.20, 12.00].sample }
unit_quantity { rand(5) < 3 ? 1 : rand(1..20) }
supplier { create :supplier }
article_category { create :article_category }
factory :article do
sequence(:name) { |n| Faker::Lorem.words(rand(2..4)).join(' ') + " ##{n}" }
supplier { create :supplier }
article_category { create :article_category }
end
factory :shared_article, class: SharedArticle do
sequence(:name) { |n| Faker::Lorem.words(rand(2..4)).join(' ') + " s##{n}" }
order_number { Faker::Lorem.characters(rand(1..12)) }
supplier { create :shared_supplier }
end
end
factory :article_category do

View file

@ -7,7 +7,7 @@ FactoryGirl.define do
supplier { create :supplier, article_count: (article_count.nil? ? true : article_count) }
article_ids { supplier.articles.map(&:id) unless supplier.nil? }
ignore do
transient do
article_count true
end

View file

@ -7,7 +7,7 @@ FactoryGirl.define do
phone { Faker::PhoneNumber.phone_number }
address { Faker::Address.street_address }
ignore do
transient do
article_count 0
end
@ -16,6 +16,8 @@ FactoryGirl.define do
article_count = rand(1..99) if article_count == true
create_list :article, article_count, supplier: supplier
end
factory :shared_supplier, class: SharedSupplier
end
end