spec/spec_helper.rb in optionsful-0.5.2 vs spec/spec_helper.rb in optionsful-0.5.3

- old
+ new

@@ -4,22 +4,22 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'baurets', 'optionsful')) require 'optionsful' require 'server' require 'introspections' -require 'spec' -require 'spec/autorun' +require 'rspec' + require 'fake_app' require 'rubygems' require 'rails' require 'rack' require 'rack/test' require 'rack/lobster' require 'fileutils' -Spec::Runner.configure do |config| +RSpec.configure do |config| 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, } @@ -65,9 +65,20 @@ response = Baurets::Optionsful::Server.new(app).call(complex_env) end def allows?(headers, method) headers["Allow"].include?(method) + end + + def should_allow(headers, *method) + methods = method + allow = headers["Allow"].gsub(',', ' ') + methods.each do |m| + allow.include?(m) + allow.gsub!(m, '') + end + allow.gsub(' ', '') + return allow.empty? end def validate_response(response) response.should be_a_kind_of Array response.size.should == 3