Permalink
Browse files

Remove static attributes in factories

  • Loading branch information...
burisu committed Aug 21, 2018
1 parent b2b472e commit f9906f428d4cc530fbfbb041c6b2ea5098e630b0
Showing with 213 additions and 213 deletions.
  1. +2 −2 test/factories/accounts.rb
  2. +11 −11 test/factories/activities.rb
  3. +4 −4 test/factories/activity_inspection_calibration_scales.rb
  4. +13 −13 test/factories/cashes.rb
  5. +1 −1 test/factories/cultivable_zones.rb
  6. +19 −19 test/factories/entities.rb
  7. +3 −3 test/factories/entity_addresses.rb
  8. +2 −2 test/factories/financial_years.rb
  9. +3 −3 test/factories/fixed_asset_depreciations.rb
  10. +4 −4 test/factories/fixed_assets.rb
  11. +4 −4 test/factories/inspection_calibration_natures.rb
  12. +4 −4 test/factories/inspection_calibrations.rb
  13. +4 −4 test/factories/inspection_point_natures.rb
  14. +4 −4 test/factories/inspection_points.rb
  15. +3 −3 test/factories/inspections.rb
  16. +1 −1 test/factories/intervention_participations.rb
  17. +1 −1 test/factories/intervention_targets.rb
  18. +5 −5 test/factories/interventions.rb
  19. +15 −15 test/factories/journal_entries.rb
  20. +19 −19 test/factories/journal_entry_items.rb
  21. +9 −9 test/factories/journals.rb
  22. +2 −2 test/factories/land_parcels.rb
  23. +3 −3 test/factories/parcels.rb
  24. +2 −2 test/factories/plants.rb
  25. +5 −5 test/factories/product_nature_variants.rb
  26. +7 −7 test/factories/product_natures.rb
  27. +24 −24 test/factories/product_readings.rb
  28. +3 −3 test/factories/purchase_affairs.rb
  29. +7 −7 test/factories/purchase_items.rb
  30. +5 −5 test/factories/purchases.rb
  31. +3 −3 test/factories/sale_affairs.rb
  32. +8 −8 test/factories/sale_items.rb
  33. +6 −6 test/factories/sales.rb
  34. +3 −3 test/factories/tax_declarations.rb
  35. +2 −2 test/factories/taxes.rb
  36. +2 −2 test/factories/users.rb
@@ -1,7 +1,7 @@
FactoryBot.define do
factory :account do
debtor false
reconcilable false
debtor { false }
reconcilable { false }
sequence(:name) { |n| "801 - Compte #{n}" }
sequence(:number) { |n| "801000000#{n}" }
end
@@ -1,23 +1,23 @@
FactoryBot.define do
factory :activity do
sequence(:name) { |n| "Fake Activity #{n}" }
family :plant_farming
production_cycle :annual
family { :plant_farming }
production_cycle { :annual }
end
factory :corn_activity, class: Activity do
sequence(:name) { |n| "Corn - TEST#{n.to_s.rjust(8, '0')}" }
family :plant_farming
production_cycle :annual
family { :plant_farming }
production_cycle { :annual }
trait :fully_inspectable do
use_gradings true
measure_grading_sizes true
grading_sizes_indicator_name :length
grading_sizes_unit_name 'centimeter'
measure_grading_net_mass true
grading_net_mass_unit_name 'kilogram'
measure_grading_items_count true
use_gradings { true }
measure_grading_sizes { true }
grading_sizes_indicator_name { :length }
grading_sizes_unit_name { 'centimeter' }
measure_grading_net_mass { true }
grading_net_mass_unit_name { 'kilogram' }
measure_grading_items_count { true }
after(:create) do |instance|
create :ugly_point_natures, activity: instance
@@ -1,7 +1,7 @@
FactoryBot.define do
factory :width_grading_scale, class: ActivityInspectionCalibrationScale do
size_unit_name 'centimeter'
size_indicator_name :width
size_unit_name { 'centimeter' }
size_indicator_name { :width }
after(:create) do |instance|
create :big_interval, scale: instance, marketable: false
@@ -10,8 +10,8 @@
end
factory :length_grading_scale, class: ActivityInspectionCalibrationScale do
size_unit_name 'centimeter'
size_indicator_name :length
size_unit_name { 'centimeter' }
size_indicator_name { :length }
after(:create) do |instance|
create :big_interval, scale: instance, marketable: true
View
@@ -2,19 +2,19 @@
factory :cash do
account
journal
bank_account_holder_name 'Dupond'
bank_account_key ''
bank_account_number ''
bank_agency_code ''
bank_code ''
bank_identifier_code 'GHBXFRPP'
bank_name 'GHB'
country 'fr'
currency 'EUR'
iban ''
spaced_iban ''
mode 'iban'
nature 'bank_account'
bank_account_holder_name { 'Dupond' }
bank_account_key { '' }
bank_account_number { '' }
bank_agency_code { '' }
bank_code { '' }
bank_identifier_code { 'GHBXFRPP' }
bank_name { 'GHB' }
country { 'fr' }
currency { 'EUR' }
iban { '' }
spaced_iban { '' }
mode { 'iban' }
nature { 'bank_account' }
sequence(:name) { |n| "Bank account #{n}" }
end
end
@@ -35,7 +35,7 @@
]
}
}'
shape Charta.new_geometry(shape)
shape { Charta.new_geometry(shape) }
sequence(:name) { |n| "Fake Cultivable Zone #{n}" }
end
end
View
@@ -1,35 +1,35 @@
FactoryBot.define do
factory :entity do
active true
client false
employee false
locked false
of_company false
prospect false
reminder_submissive false
supplier false
transporter false
vat_subjected true
currency 'EUR'
language 'fra'
nature 'contact'
full_name 'Dupond Comptable'
last_name 'Dupond'
country 'fr'
iban ''
active { true }
client { false }
employee { false }
locked { false }
of_company { false }
prospect { false }
reminder_submissive { false }
supplier { false }
transporter { false }
vat_subjected { true }
currency { 'EUR' }
language { 'fra' }
nature { 'contact' }
full_name { 'Dupond Comptable' }
last_name { 'Dupond' }
country { 'fr' }
iban { '' }
trait :accountant do
end
trait :client do
client true
client { true }
after(:build) do |entity|
entity.client_account = Account.find_by!(number: '411')
end
end
trait :supplier do
supplier true
supplier { true }
after(:build) do |entity|
entity.supplier_account = Account.find_by!(number: '401')
end
@@ -1,9 +1,9 @@
FactoryBot.define do
factory :entity_address do
entity
canal 'email'
by_default true
mail_auto_update false
canal { 'email' }
by_default { true }
mail_auto_update { false }
sequence(:coordinate) { |n| "email#{n}@test.com" }
trait :email do
@@ -1,6 +1,6 @@
FactoryBot.define do
factory :financial_year do
started_on '01/01/1994'
stopped_on '31/12/1994'
started_on { '01/01/1994' }
stopped_on { '31/12/1994' }
end
end
@@ -1,8 +1,8 @@
FactoryBot.define do
factory :fixed_asset_depreciation do
fixed_asset
amount 15.07
started_on Date.civil(2020, 8, 1)
stopped_on Date.civil(2020, 8, 10)
amount { 15.07 }
started_on { Date.civil(2020, 8, 1) }
stopped_on { Date.civil(2020, 8, 10) }
end
end
@@ -1,12 +1,12 @@
FactoryBot.define do
factory :fixed_asset do
association :allocation_account, factory: :account
depreciation_method 'simplified_linear'
depreciation_method { 'simplified_linear' }
journal
depreciable_amount 860.32
depreciable_amount { 860.32 }
sequence(:name) { |n| "Fixed asset #{n}" }
started_on Date.civil(2017, 8, 11)
stopped_on Date.civil(2020, 8, 10)
started_on { Date.civil(2017, 8, 11) }
stopped_on { Date.civil(2020, 8, 10) }
association :asset_account, factory: :account
association :expenses_account, factory: :account
end
@@ -1,11 +1,11 @@
FactoryBot.define do
factory :small_interval, class: ActivityInspectionCalibrationNature do
minimal_value 100
maximal_value 150
minimal_value { 100 }
maximal_value { 150 }
end
factory :big_interval, class: ActivityInspectionCalibrationNature do
minimal_value 150
maximal_value 200
minimal_value { 150 }
maximal_value { 200 }
end
end
@@ -1,9 +1,9 @@
FactoryBot.define do
factory :inspection_calibration do
net_mass_value 15
items_count_value 500
net_mass_value { 15 }
items_count_value { 500 }
minimal_size_value 8
maximal_size_value 13
minimal_size_value { 8 }
maximal_size_value { 13 }
end
end
@@ -1,11 +1,11 @@
FactoryBot.define do
factory :ugly_point_natures, class: ActivityInspectionPointNature do
name 'Ugly'
category :deformity
name { 'Ugly' }
category { :deformity }
end
factory :sick_point_natures, class: ActivityInspectionPointNature do
name 'Sick'
category :disease
name { 'Sick' }
category { :disease }
end
end
@@ -1,9 +1,9 @@
FactoryBot.define do
factory :inspection_point do
net_mass_value 12
items_count_value 240
net_mass_value { 12 }
items_count_value { 240 }
minimal_size_value 4
maximal_size_value 13
minimal_size_value { 4 }
maximal_size_value { 13 }
end
end
@@ -1,9 +1,9 @@
FactoryBot.define do
factory :corn_inspection, class: Inspection do
sampled_at { DateTime.now }
sampling_distance 3.in :meter
implanter_rows_number 3
implanter_application_width 1.in :meter
sampling_distance { 3.in :meter }
implanter_rows_number { 3 }
implanter_application_width { 1.in :meter }
association :product, factory: :corn_plant
association :activity, :fully_inspectable, factory: :corn_activity
@@ -1,6 +1,6 @@
FactoryBot.define do
factory :intervention_participation do
product
state 'in_progress'
state { 'in_progress' }
end
end
@@ -1,6 +1,6 @@
FactoryBot.define do
factory :intervention_target do
reference_name 'land_parcel'
reference_name { 'land_parcel' }
product
intervention
end
@@ -1,9 +1,9 @@
FactoryBot.define do
factory :intervention do
procedure_name 'sowing'
started_at Time.now - 2.hours
stopped_at Time.now - 1.hour
working_duration 3600
actions [:sowing]
procedure_name { 'sowing' }
started_at { Time.now - 2.hours }
stopped_at { Time.now - 1.hour }
working_duration { 3600 }
actions { [:sowing] }
end
end
@@ -1,26 +1,26 @@
FactoryBot.define do
factory :journal_entry do
journal
absolute_credit 0
absolute_debit 0
absolute_currency 'EUR'
credit 0
debit 0
balance 0
currency 'EUR'
real_credit 0
real_debit 0
real_balance 0
real_currency 'EUR'
real_currency_rate 1.0
state 'draft'
printed_on Date.parse('2016-12-01')
absolute_credit { 0 }
absolute_debit { 0 }
absolute_currency { 'EUR' }
credit { 0 }
debit { 0 }
balance { 0 }
currency { 'EUR' }
real_credit { 0 }
real_debit { 0 }
real_balance { 0 }
real_currency { 'EUR' }
real_currency_rate { 1.0 }
state { 'draft' }
printed_on { Date.parse('2016-12-01') }
trait :draft do
end
trait :confirmed do
state 'confirmed'
state { 'confirmed' }
end
trait :with_items do
Oops, something went wrong.

0 comments on commit f9906f4

Please sign in to comment.