I was wondering if anyone knows if FactoryGirl can be used without any of the above preconditions.
I would like to use it to generate test data on the fly when testing user interface automation for both mobile and web sites, and even for the API.
I know that I could create some custom helper classes / methods and use getters and setters, etc., but I thought it would be nice to use this amazing little stone.
I searched quite extensively and also tried to create a basic RSpec project (I also tried Cucumber), but to no avail. It still seems that I need classes to be created with the appropriate login to consume it.
FactoryGirl.define do factory :user do firstname { Faker::Name.first_name } lastname { Faker::Name.last_name } age { 1 + rand(100) } end end
Then, if I try to call it in the RSpec file ...
describe... it... user = build_stubbed(:user) end end
I also read the docs and tried all the other options, I just keep getting ...
Failure/Error: user = build_stubbed(:user) NameError: uninitialized constant User
which assumes that I need a User class with logic.
source share