diff --git a/db/seeds.rb b/db/seeds.rb index eb31f04..4bfed3d 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -10,10 +10,12 @@ puts "-- email: #{admin_email}" puts "-- password: #{admin_pass}" puts "" puts "Be sure to change these credentials ASAP!" -User.create!({ +user = User.new({ :name => 'Errbit Admin', :email => admin_email, :password => admin_pass, :password_confirmation => admin_pass, - :admin => true -}) \ No newline at end of file +}) + +user.admin = true +user.save! \ No newline at end of file diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c031589..222c7fa 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -38,5 +38,14 @@ describe User do end end + + context "First user" do + it "should be created this admin access via db:seed" do + require 'rake' + Errbit::Application.load_tasks + Rake::Task["db:seed"].execute + User.first.admin.should be_true + end + end end -- libgit2 0.21.2