Created
December 15, 2017 18:39
-
-
Save theoretick/afb9666b0809c470b75002f84d0578dd to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# forked from https://gist.github.com/Draiken/dbe1bd2af0d583c28d75 | |
echo "Generating rails app" | |
rails new fabrication_test --quiet | |
cd fabrication_test | |
echo "gem 'fabrication'" >> Gemfile | |
echo "Installing fabrication" | |
bundle install > /dev/null | |
echo "Generating models and fabricators" | |
mkdir test/fabricators | |
cat > test/fabricators/fabricators.rb <<EOF | |
Fabricator(:author) do | |
end | |
Fabricator(:post) do | |
author | |
end | |
EOF | |
rails g model author --quiet | |
rails g model post author:references --quiet | |
rake db:migrate > /dev/null | |
echo "Running: rails runner \"puts Fabricate(:post, author_id: 999).author_id\"" | |
rails runner "puts Fabricate(:post, author_id: 999).author_id" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment