Skip to content

Instantly share code, notes, and snippets.

@thisismydesign
Last active January 26, 2019 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisismydesign/327e7de16629570a4eb046200cd3350c to your computer and use it in GitHub Desktop.
Save thisismydesign/327e7de16629570a4eb046200cd3350c to your computer and use it in GitHub Desktop.
Ruby: When and how to use factories for seeding? /3
# 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