spec/spec_helper.rb in optionsful-0.2.3 vs spec/spec_helper.rb in optionsful-0.3.0
- old
+ new
@@ -1,26 +1,26 @@
-require File.join(File.dirname(__FILE__), '..', 'lib', "baurets", 'optionsful', "config.rb")
-require File.join(File.dirname(__FILE__), '..', 'lib', "baurets", 'optionsful', "server.rb")
-require File.join(File.dirname(__FILE__), '..', 'lib', "baurets", 'optionsful', "introspections.rb")
-# TODO ^ this was ugly?! :-S
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'baurets'))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'baurets', 'optionsful'))
+require 'optionsful'
+require 'server'
+require 'introspections'
-require 'rubygems'
-require 'sinatra'
-require 'rack/test'
+require 'spec'
+require 'spec/autorun'
+require 'fake_app'
+require 'rubygems'
+
+require 'rails'
require 'rack'
+require 'rack/test'
require 'rack/lobster'
-require 'spec'
-require 'spec/autorun'
-require 'spec/interop/test'
-require 'action_controller'
+Spec::Runner.configure do |config|
-# set test environment
-set :environment, :test
-set :run, false
-set :raise_errors, true
-set :logging, true
+end
DEFAULT_ENV = { "rack.version" => Rack::VERSION, "rack.input" => StringIO.new, "rack.errors" => StringIO.new,
"rack.multithread" => true, "rack.multiprocess" => true, "rack.run_once" => false, }
SAMPLE_ENV = {"rack.session"=>{:session_id=>"f66c8af1e89f318775e923159e046e71"}, "SERVER_NAME"=>"localhost",
@@ -65,8 +65,18 @@
end
def allows?(headers, method)
headers["Allow"].include?(method)
end
-
-
-
+
+ def validate_response(response)
+ response.should be_a_kind_of Array
+ response.size.should == 3
+ response[0].should be_a_kind_of Fixnum
+ response[1].should be_a_kind_of Hash
+ response[2].should_not be nil
+ end
+
+ def rails_app
+ app = FakeApp.initialize!
+ app
+ end
\ No newline at end of file