Add Additional Library to Faker :: RSpec :: TDD

Suppose you are working on a project in which you want to test a Applicant Model. Applicant may have any value among options in a drop-down. If you want the spec should fill the education field with the data you wish, then you can modify the Faker module. To do so, the best way is the following

create a folder in spec/ directory
create a file called ‘anything_you_want.rb’

# inside the file 'anything_you_want.rb'
class Faker::Occupation
    list = ['High School', 'College', 'School']

Un-comment the line from the file ‘rails_helper.rb’

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s