ruby - Why are Faker's methods in several modules? -
i'm looking @ gem: https://github.com/stympy/faker
i use quite lot, , good, don't why of methods organised modules:
faker::code.isbn #=> "759021701-8" faker::address.longitude #=> "-156.65548382095133" faker::bitcoin.address #=> "1huogjmgchmnxxyhz87yytv4gvjfpaexmh"
i have in factories:
factory :person, class: person name { faker::lorem.word } account { faker::bitcoin.address } address { faker::address.longitude } favourite_book { faker::code.isbn } end
can include of modules test suite need this:
factory :person, class: person name { word } account { address } address { longitude } favourite_book { isbn } end
i'm using rspec:
rspec.configure |config| config.include factorygirl::syntax::methods # doesn't work: config.include faker end
why have bothered separating methods separate methods? make faster? surely negligible amount unless you've got insanely complex project? wouldn't better gem let betterfaker.word
, betterfaker.address
ect? easier remember :)
i willing venture authors of gem organize files in logical manner, , keep methods have different scopes in different places.
Comments
Post a Comment