Commit 4411c516e13b9f9e99caca329c676d6c22a4fcb6
1 parent
32d574d6
Exists in
master
and in
1 other branch
Rake task to prepare and run api server for acceptance testing
Showing
1 changed file
with
24 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
| 1 | + | ||
| 2 | +namespace :testserver do | ||
| 3 | + | ||
| 4 | + | ||
| 5 | + desc "Start a server for testing purposes on port 4000" | ||
| 6 | + task :start do | ||
| 7 | + | ||
| 8 | + system "export RAILS_ENV=test && #{Rails.root.to_s}/script/server -p 4000" | ||
| 9 | + end | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + task :prepare => :test do | ||
| 13 | + Rake::Task["db:test:prepare"].invoke | ||
| 14 | + | ||
| 15 | + u = User.create!(:email => 'testing@dkapadia.com', :password => 'wheatthins', :password_confirmation => "wheatthins") | ||
| 16 | + | ||
| 17 | + u.email_confirmed = true | ||
| 18 | + u.save | ||
| 19 | + | ||
| 20 | + end | ||
| 21 | + | ||
| 22 | + task :launch => [:prepare, :start] | ||
| 23 | +end | ||
| 24 | + |