Skip to content

Instantly share code, notes, and snippets.

@Grandvizir
Created January 20, 2015 13:07
Show Gist options
  • Save Grandvizir/3f5f11a74cf0498b2ae6 to your computer and use it in GitHub Desktop.
Save Grandvizir/3f5f11a74cf0498b2ae6 to your computer and use it in GitHub Desktop.
Rails initializers
# test/controllers/users_controller_test.rb
class UsersControllerTest < ActionController::TestCase
setup do
@user_admin = User.find_by_email('[email protected]') #=> Not Find..
@user = User.new(email: '[email protected]', name: 'Jean', token: 'plop', public_key: 'plip')
# test helper method
login_as(@user_admin)
end
end
# config/initializers/data_initializer.rb
User.create(email: '[email protected]', role: -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment