Skip to content

Commit

Permalink
gem faker to generate fake posts
Browse files Browse the repository at this point in the history
  • Loading branch information
yshmarov committed Mar 11, 2021
1 parent ebb38db commit 35ee68e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'master'
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
GIT
remote: https://github.com/faker-ruby/faker.git
revision: 71f3b74aab28903b1b34bccd17cf9739ef630db0
branch: master
specs:
faker (2.16.0)
i18n (>= 1.6, < 2)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -205,6 +213,7 @@ DEPENDENCIES
bootsnap (>= 1.4.4)
byebug
capybara (>= 3.26)
faker!
jbuilder (~> 2.7)
listen (~> 3.3)
pg (~> 1.1)
Expand Down
14 changes: 7 additions & 7 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
10.times do
Post.create(
title: Faker::Lorem.sentence(word_count: 3),
content: Faker::Lorem.sentence,
premium: [true, false].sample
)
end

0 comments on commit 35ee68e

Please sign in to comment.