Permalink
Browse files

Convenience scripts

Upgraded script so that I can make myself a member of Invo for testing
purposes.
  • Loading branch information...
1 parent 6397a9b commit 2db958a68d3bb401b63cb8135bbad4393729e4d9 @Veejay Veejay committed Oct 17, 2012
Showing with 31 additions and 0 deletions.
  1. +3 −0 cleanslate.sh
  2. +28 −0 lib/tasks/involution.rake
View
@@ -15,3 +15,6 @@ RAILS_ENV=test bundle exec rake db:migrate
# Run the tests
bundle exec rspec
+
+# Make Bertrand part of Involution Studios for testing purposes
+bundle exec rake db:involution
View
@@ -0,0 +1,28 @@
+namespace :db do
+ desc "Associate Bertrand to Involution Studios for testing"
+ task :involution => :environment do
+ if Rails.env.development?
+
+ @user = User.where({
+ first_name: "Bertrand",
+ last_name: "Chardon",
+ email: "bertrand.chardon@gmail.com"
+ }).first
+
+ @company = Company.where({
+ name: "Involution Studios"
+ }).first
+
+ unless [@company, @user].any? { |variable| variable.nil? }
+ begin
+ @company.users << @user
+ @user.current_company_id = @company.id
+ @user.save
+ rescue => kaboom
+ puts "ERROR WHILE SAVING: #{kaboom}"
+ end
+ puts "DONE !!!"
+ end
+ end
+ end
+end

0 comments on commit 2db958a

Please sign in to comment.