Skip to content
Browse files

removed deprecation warnings in Rakefile

  • Loading branch information...
1 parent 88544ea commit b1f0ea74a6e0f46ed2696165d26e71d065d21ea8 @brunoadacosta brunoadacosta committed Jul 31, 2012
Showing with 12 additions and 12 deletions.
  1. +12 −12 Rakefile
View
24 Rakefile
@@ -1,8 +1,8 @@
require 'rubygems'
require 'rubygems/specification'
require 'rake'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
+require 'rubygems/package_task'
+require 'rdoc/task'
require 'rspec'
require 'rspec/core'
require 'rspec/core/rake_task'
@@ -16,7 +16,7 @@ GEM_VERSION = Restfulie::VERSION
module FakeServer
def self.wait_server(port=3000)
- (1..15).each do
+ (1..15).each do
begin
Net::HTTP.get(URI.parse("http://localhost:#{port}/"))
return
@@ -26,15 +26,15 @@ module FakeServer
end
raise "Waited for the server but it did not finish"
end
-
+
def self.start_sinatra
IO.popen("cd tests && ruby ./spec/requests/fake_server.rb") do |pipe|
wait_server 4567
yield
Process.kill 'INT', pipe.pid
end
end
-
+
def self.run(setup, process)
success = IO.popen(setup) do |pipe|
wait_server
@@ -46,15 +46,15 @@ module FakeServer
raise "Some of the specs failed"
end
end
-
+
def self.start_server_and_run_spec(target_dir)
success = Dir.chdir(File.join(File.dirname(__FILE__), target_dir)) do
system('bundle install')
system('rake db:drop db:create db:migrate')
self.run "rails server", "rake spec"
end
end
-
+
end
# optionally loads a task if the required gems exist
@@ -65,28 +65,28 @@ def optionally
end
namespace :test do
-
+
task :spec do
FakeServer.start_sinatra do
FakeServer.start_server_and_run_spec "tests"
end
end
-
+
task :integration do
FakeServer.start_server_and_run_spec "full-examples/rest_from_scratch/part_1"
FakeServer.start_server_and_run_spec "full-examples/rest_from_scratch/part_2"
FakeServer.start_server_and_run_spec "full-examples/rest_from_scratch/part_3"
end
-
+
task :sinatra do
FakeServer.start_sinatra do
puts "Press something to quit"
gets
end
end
-
+
task :all => ["spec","integration"]
-
+
end
RSpec::Core::RakeTask.new(:spec) do |t|

0 comments on commit b1f0ea7

Please sign in to comment.
Something went wrong with that request. Please try again.