Skip to content

Instantly share code, notes, and snippets.

@arubis
Created March 25, 2020 19:58
Show Gist options
  • Save arubis/e26dc1ba6e2df602384961708f224ce4 to your computer and use it in GitHub Desktop.
Save arubis/e26dc1ba6e2df602384961708f224ce4 to your computer and use it in GitHub Desktop.
Asking for a friend!
FactoryBot.define do
factory :car_communication_rule do
rule_id { SecureRandom.uuid }
end
trait :tire_pressure do
transient do
tp_code { "FR" }
tp_name { "Front right" }
end
category { :tire_pressure }
demo_data do
MyApiCall.send(:method_name,
"TIREPRESSURE#{tp_code}",
"#{tp_name} tire pressure is low")
end
end
trait :tire_pressure_front_left do
transient do
tp_code { "FL" }
tp_name { "Front left" }
end
tire_pressure
end
# then similar for :tire_pressure_front_right, _rear_left, _rear_right
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment