Last active
January 26, 2019 18:03
-
-
Save thisismydesign/327e7de16629570a4eb046200cd3350c to your computer and use it in GitHub Desktop.
Ruby: When and how to use factories for seeding? /3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# db/seeds/test.rb | |
build_stubbed(:user) | |
def seed_user_pagination_data | |
FactoryBot.create_list(:user, 10) | |
end | |
# user_spec.rb | |
it "returns user" do | |
# ... | |
end | |
context "when there're many users" | |
before do | |
seed_user_pagination_data | |
end | |
it "paginates users" do | |
# ... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment