Last Updated: February 25, 2016
·
610
· rdsoze

Factory Hashes

We can use Factory Girl for generating factories that can be used to test APIs. These can be used like any other factory.

factory :user_params, class:Hash do
  company_id '123'
  user_id '234'
  username 'test'
  email "test@test.com"
  first_name 'Foolish'
  last_name 'tester'

  initialize_with { attributes }
end