Michael Granger avatar Michael Granger committed 44fa184

Convert specs to new RSpec syntax.

Comments (0)

Files changed (48)

 examples/templates/layout.tmpl
 examples/templates/upload-form.tmpl
 examples/templates/upload-success.tmpl
+examples/var/uploads/mongrel2.upload.DZ32Ds
+examples/var/uploads/mongrel2.upload.FjBr1H
+examples/var/uploads/mongrel2.upload.hGj4Gt
+examples/var/uploads/mongrel2.upload.jHDNgQ
+examples/var/uploads/mongrel2.upload.wdL0Cw
 lib/strelka.rb
 lib/strelka/app.rb
 lib/strelka/app/auth.rb
 lib/strelka/testing.rb
 lib/strelka/websocketserver.rb
 lib/strelka/websocketserver/routing.rb
+spec/constants.rb
 spec/data/error.tmpl
 spec/data/forms/2_images.form
 spec/data/forms/singleupload.form
 spec/data/forms/testform_truncated_metadata.form
 spec/data/layout.tmpl
 spec/data/main.tmpl
-spec/lib/constants.rb
-spec/lib/helpers.rb
+spec/helpers.rb
 spec/strelka/app/auth_spec.rb
 spec/strelka/app/errors_spec.rb
 spec/strelka/app/filters_spec.rb
 	def start_command( *args )
 		appname = args.pop
 		gemname = args.pop
-		path, gemname = Strelka::Discovery.find( appname, gemname )
+		path    = nil
 
-		header "Starting the %s app%s" % [
-			appname,
-			gemname == '' ? '' : " from the #{gemname} gem"
-		]
+		if File.exist?( appname )
+			header "Starting %s." % [ appname ]
+			path = appname
+		else
+			path, gemname = Strelka::Discovery.find( appname, gemname )
+
+			header "Starting the %s app%s" % [
+				appname,
+				gemname == '' ? '' : " from the #{gemname} gem"
+			]
+		end
 
 		apps = Strelka::Discovery.load( path )
 		Strelka.load_config( self.options.config ) if self.options.config

lib/strelka/app.rb

 
 
 	### Overridden from Mongrel2::Handler -- use the value returned from .default_appid if
-	### one is not specified, and automatically install the config DB if it hasn't been
-	### already.
+	### one is not specified.
 	def self::run( appid=nil )
 		appid ||= self.default_appid
 		self.log.info "Starting up with appid %p." % [ appid ]

lib/strelka/app/restresources.rb

 		end
 
 
-		### Add a handler method for updating all instances of +rsrcobj+ collection.
+		### Add a handler method for replacing all instances of +rsrcobj+ collection.
 		### PUT /resources
 		def add_collection_update_handler( route, rsrcobj, options )
 			pkey = rsrcobj.primary_key
 				# Save it in a transaction, erroring if any of 'em fail validations
 				begin
 					rsrcobj.db.transaction do
-						rsrcobj.update( newvals )
+						rsrcobj.truncate
+						rsrcobj.create( newvals )
 					end
 				rescue Sequel::ValidationFailed => err
 					finish_with( HTTP::BAD_REQUEST, err.message )

lib/strelka/behavior/plugin.rb

 
 
 	it "extends Strelka::Plugin" do
-		plugin.should be_a( Strelka::Plugin )
+		expect( plugin ).to be_a( Strelka::Plugin )
 	end
 
 end

lib/strelka/httprequest.rb

 		when 'application/json', 'text/javascript'
 			return Yajl.load( self.body )
 		when 'text/x-yaml', 'application/x-yaml'
+			return nil if self.body.eof?
 			return YAML.load( self.body, safe: true )
 		when 'multipart/form-data'
 			boundary = self.content_type[ /\bboundary=(\S+)/, 1 ] or

spec/constants.rb

+# -*- ruby -*-
+# vim: set nosta noet ts=4 sw=4:
+# encoding: utf-8
+
+require 'strelka' unless defined?( Strelka )
+
+
+### A collection of constants used in testing
+module Strelka::TestConstants # :nodoc:all
+
+	include Strelka::Constants,
+	        Mongrel2::WebSocket::Constants
+
+	unless defined?( TEST_HOST )
+
+		TEST_HOST = 'localhost'
+
+		# App id for testing
+		TEST_APPID = 'BD17D85C-4730-4BF2-999D-9D2B2E0FCCF9'
+
+		# 0mq socket specifications for Handlers
+		TEST_SEND_SPEC = 'tcp://127.0.0.1:9998'
+		TEST_RECV_SPEC = 'tcp://127.0.0.1:9997'
+
+
+		# Freeze all testing constants
+		constants.each do |cname|
+			const_get(cname).freeze if cname.to_s.start_with?( 'TEST_' )
+		end
+	end
+
+end
+
+
+#!/usr/bin/ruby
+# coding: utf-8
+
+BEGIN {
+	require 'pathname'
+	basedir = Pathname.new( __FILE__ ).dirname.parent.parent
+
+	srcdir = basedir.parent
+	mongrel2dir = srcdir + 'Mongrel2/lib'
+
+	$LOAD_PATH.unshift( mongrel2dir.to_s ) unless
+		!mongrel2dir.directory? || $LOAD_PATH.include?( mongrel2dir.to_s )
+}
+
+# SimpleCov test coverage reporting; enable this using the :coverage rake task
+if ENV['COVERAGE']
+	$stderr.puts "\n\n>>> Enabling coverage report.\n\n"
+	require 'simplecov'
+	SimpleCov.start do
+		add_filter 'spec'
+		add_group "Needing tests" do |file|
+			file.covered_percent < 90
+		end
+	end
+end
+
+require 'loggability'
+require 'loggability/spechelpers'
+require 'configurability'
+require 'pathname'
+require 'tmpdir'
+
+require 'rspec'
+require 'mongrel2'
+require 'mongrel2/testing'
+
+require 'strelka'
+require 'strelka/testing'
+
+require_relative 'constants'
+
+Loggability.format_with( :color ) if $stdout.tty?
+
+
+### RSpec helper functions.
+module Strelka::SpecHelpers
+	include Strelka::TestConstants,
+	        Strelka::Testing
+
+	###############
+	module_function
+	###############
+
+	### Make an easily-comparable version vector out of +ver+ and return it.
+	def vvec( ver )
+		return ver.split('.').collect {|char| char.to_i }.pack('N*')
+	end
+
+
+	### Set up a Mongrel2 configuration database according to the specified +dbspec+.
+	### Set up a Mongrel2 configuration database in memory.
+	def setup_config_db
+		Mongrel2::Config.db ||= Mongrel2::Config.in_memory_db
+		Mongrel2::Config.init_database
+		Mongrel2::Config.db.tables.collect {|t| Mongrel2::Config.db[t] }.each( &:truncate )
+	end
+
+
+	# Helper method
+	def route( name )
+		return {:action => name.to_sym}
+	end
+
+
+	### Create a temporary working directory and return
+	### a Pathname object for it.
+	###
+	def make_tempdir
+		dirname = "%s.%d.%0.4f" % [
+			'strelka_spec',
+			Process.pid,
+			(Time.now.to_f % 3600),
+		  ]
+		tempdir = Pathname.new( Dir.tmpdir ) + dirname
+		tempdir.mkpath
+
+		return tempdir
+	end
+
+
+	### Make and return a dummy gemspec with the given +name+ and +version+, and inject a
+	### dependency on 'strelka' if +strelka_dep+ is true.
+	def make_gemspec( name, version, strelka_dep=true )
+		spec = Gem::Specification.new( name, version )
+		spec.add_runtime_dependency( 'strelka', '~> 0.0' ) if strelka_dep
+		return spec
+	end
+
+
+end
+
+
+### Mock with RSpec
+RSpec.configure do |config|
+	include Strelka::TestConstants
+
+	config.treat_symbols_as_metadata_keys_with_true_values = true
+	config.run_all_when_everything_filtered = true
+	config.filter_run :focus
+	config.order = 'random'
+	config.mock_with( :rspec ) do |mock|
+		mock.syntax = :expect
+	end
+
+	config.extend( Strelka::TestConstants )
+
+	config.include( Loggability::SpecHelpers )
+	config.include( Mongrel2::SpecHelpers )
+	config.include( Strelka::SpecHelpers )
+end
+
+# vim: set nosta noet ts=4 sw=4:
+

spec/lib/constants.rb

-# -*- ruby -*-
-# vim: set nosta noet ts=4 sw=4:
-# encoding: utf-8
-
-require 'strelka' unless defined?( Strelka )
-
-
-### A collection of constants used in testing
-module Strelka::TestConstants # :nodoc:all
-
-	include Strelka::Constants,
-	        Mongrel2::WebSocket::Constants
-
-	unless defined?( TEST_HOST )
-
-		TEST_HOST = 'localhost'
-
-		# App id for testing
-		TEST_APPID = 'BD17D85C-4730-4BF2-999D-9D2B2E0FCCF9'
-
-		# 0mq socket specifications for Handlers
-		TEST_SEND_SPEC = 'tcp://127.0.0.1:9998'
-		TEST_RECV_SPEC = 'tcp://127.0.0.1:9997'
-
-
-		# Freeze all testing constants
-		constants.each do |cname|
-			const_get(cname).freeze if cname.to_s.start_with?( 'TEST_' )
-		end
-	end
-
-end
-
-

spec/lib/helpers.rb

-#!/usr/bin/ruby
-# coding: utf-8
-
-BEGIN {
-	require 'pathname'
-	basedir = Pathname.new( __FILE__ ).dirname.parent.parent
-
-	srcdir = basedir.parent
-	mongrel2dir = srcdir + 'Mongrel2/lib'
-
-	libdir = basedir + "lib"
-
-	$LOAD_PATH.unshift( mongrel2dir.to_s ) unless $LOAD_PATH.include?( mongrel2dir.to_s )
-	$LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
-	$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
-}
-
-# SimpleCov test coverage reporting; enable this using the :coverage rake task
-if ENV['COVERAGE']
-	$stderr.puts "\n\n>>> Enabling coverage report.\n\n"
-	require 'simplecov'
-	SimpleCov.start do
-		add_filter 'spec'
-		add_group "Needing tests" do |file|
-			file.covered_percent < 90
-		end
-	end
-end
-
-require 'loggability'
-require 'loggability/spechelpers'
-require 'configurability'
-require 'pathname'
-require 'tmpdir'
-
-require 'rspec'
-require 'mongrel2'
-require 'mongrel2/testing'
-
-require 'strelka'
-require 'strelka/testing'
-
-require 'spec/lib/constants'
-
-Loggability.format_with( :color ) if $stdout.tty?
-
-
-### RSpec helper functions.
-module Strelka::SpecHelpers
-	include Strelka::TestConstants,
-	        Strelka::Testing
-
-	###############
-	module_function
-	###############
-
-	### Make an easily-comparable version vector out of +ver+ and return it.
-	def vvec( ver )
-		return ver.split('.').collect {|char| char.to_i }.pack('N*')
-	end
-
-
-	### Set up a Mongrel2 configuration database according to the specified +dbspec+.
-	### Set up a Mongrel2 configuration database in memory.
-	def setup_config_db
-		Mongrel2::Config.db ||= Mongrel2::Config.in_memory_db
-		Mongrel2::Config.init_database
-		Mongrel2::Config.db.tables.collect {|t| Mongrel2::Config.db[t] }.each( &:truncate )
-	end
-
-
-	# Helper method
-	def route( name )
-		return {:action => name.to_sym}
-	end
-
-
-	### Create a temporary working directory and return
-	### a Pathname object for it.
-	###
-	def make_tempdir
-		dirname = "%s.%d.%0.4f" % [
-			'strelka_spec',
-			Process.pid,
-			(Time.now.to_f % 3600),
-		  ]
-		tempdir = Pathname.new( Dir.tmpdir ) + dirname
-		tempdir.mkpath
-
-		return tempdir
-	end
-
-
-	### Make and return a dummy gemspec with the given +name+ and +version+, and inject a
-	### dependency on 'strelka' if +strelka_dep+ is true.
-	def make_gemspec( name, version, strelka_dep=true )
-		spec = Gem::Specification.new( name, version )
-		spec.add_runtime_dependency( 'strelka', '~> 0.0' ) if strelka_dep
-		return spec
-	end
-
-
-end
-
-
-abort "You need a version of RSpec >= 2.6.0" unless defined?( RSpec )
-
-### Mock with RSpec
-RSpec.configure do |c|
-	include Strelka::TestConstants
-
-	c.mock_with( :rspec )
-
-	c.extend( Strelka::TestConstants )
-
-	c.include( Loggability::SpecHelpers )
-	c.include( Mongrel2::SpecHelpers )
-	c.include( Strelka::SpecHelpers )
-end
-
-# vim: set nosta noet ts=4 sw=4:
-

spec/strelka/app/auth_spec.rb

 #!/usr/bin/env ruby
 
-BEGIN {
-	require 'pathname'
-	basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
-	$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
-}
+require_relative '../../helpers'
 
 require 'rspec'
 require 'rspec/mocks'
 
-require 'spec/lib/helpers'
-
 require 'strelka'
 require 'strelka/plugins'
 require 'strelka/app/auth'
 			plugins :auth
 		end
 
-		app.auth_provider.should be_a( Class )
-		app.auth_provider.should < Strelka::AuthProvider
+		expect( app.auth_provider ).to be_a( Class )
+		expect( app.auth_provider ).to be < Strelka::AuthProvider
 	end
 
 	it "adds the Auth mixin to the request class" do
 		end
 		app.install_plugins
 
-		@request_factory.get( '/api/v1/verify' ).should respond_to( :authenticated? )
+		expect( @request_factory.get( '/api/v1/verify' ) ).to respond_to( :authenticated? )
 	end
 
 
 			app = @app.new
 			req = @request_factory.get( '/api/v1' )
 
-			app.auth_provider.should_receive( :authenticate ).and_return( 'anonymous' )
-			app.auth_provider.should_receive( :authorize )
+			expect( app.auth_provider ).to receive( :authenticate ).and_return( 'anonymous' )
+			expect( app.auth_provider ).to receive( :authorize )
 
 			res = app.handle( req )
 
-			res.status.should == HTTP::OK
+			expect( res.status ).to eq( HTTP::OK )
 		end
 
 		it "doesn't have any auth criteria by default" do
-			@app.should_not have_auth_criteria()
+			expect( @app ).to_not have_auth_criteria()
 		end
 
 		it "sets the authenticated_user attribute of the request to the credentials of the authenticating user" do
 			app = @app.new
 			req = @request_factory.get( '/api/v1' )
 
-			app.auth_provider.should_receive( :authenticate ).and_return( 'anonymous' )
-			app.auth_provider.should_receive( :authorize ).and_return( true )
+			expect( app.auth_provider ).to receive( :authenticate ).and_return( 'anonymous' )
+			expect( app.auth_provider ).to receive( :authorize ).and_return( true )
 
 			app.handle( req )
-			req.authenticated_user.should == 'anonymous'
+			expect( req.authenticated_user ).to eq( 'anonymous' )
 		end
 
 		it "has its configured auth provider inherited by subclasses" do
 			Strelka::App::Auth.configure( :provider => 'basic' )
 			subclass = Class.new( @app )
-			subclass.auth_provider.should == Strelka::AuthProvider::Basic
+			expect( subclass.auth_provider ).to eq( Strelka::AuthProvider::Basic )
 		end
 
 		it "has its auth config inherited by subclasses" do
 			subclass = Class.new( @app )
 
-			subclass.positive_auth_criteria.should == @app.positive_auth_criteria
-			subclass.positive_auth_criteria.should_not equal( @app.positive_auth_criteria )
-			subclass.negative_auth_criteria.should == @app.negative_auth_criteria
-			subclass.negative_auth_criteria.should_not equal( @app.negative_auth_criteria )
-			subclass.positive_perms_criteria.should == @app.positive_perms_criteria
-			subclass.positive_perms_criteria.should_not equal( @app.positive_perms_criteria )
-			subclass.negative_perms_criteria.should == @app.negative_perms_criteria
-			subclass.negative_perms_criteria.should_not equal( @app.negative_perms_criteria )
+			expect( subclass.positive_auth_criteria ).to eq( @app.positive_auth_criteria )
+			expect( subclass.positive_auth_criteria ).to_not equal( @app.positive_auth_criteria )
+			expect( subclass.negative_auth_criteria ).to eq( @app.negative_auth_criteria )
+			expect( subclass.negative_auth_criteria ).to_not equal( @app.negative_auth_criteria )
+			expect( subclass.positive_perms_criteria ).to eq( @app.positive_perms_criteria )
+			expect( subclass.positive_perms_criteria ).to_not equal( @app.positive_perms_criteria )
+			expect( subclass.negative_perms_criteria ).to eq( @app.negative_perms_criteria )
+			expect( subclass.negative_perms_criteria ).to_not equal( @app.negative_perms_criteria )
+		end
+
+
+		RSpec::Matchers.define( :require_auth_for_request ) do |request|
+			match do |app|
+				app.request_should_auth?( request )
+			end
 		end
 
 
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app ).to require_auth_for_request( req )
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/strong' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/stri' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/string/long' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 		end
 
 		it "allows auth criteria to be declared with a regexp" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/stri' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/stro' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/string' ) # not right-bound
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/string/long' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/other/string/long' ) # Not left-bound
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/chatlog' ) # Not left-bound
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 		end
 
 		it "allows auth criteria to be declared with a string and a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.post( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.put( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.delete( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.options( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 		end
 
 		it "allows auth criteria to be declared with a regexp and a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/regexp' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/regexp/a_username' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/regexp/%20not+a+username' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 		end
 
 		it "allows auth criteria to be declared with just a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/strong' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/marlon_brando' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.post( '/api/v1/somewhere' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.put( '/api/v1/somewhere' )
 			req.content_type = 'application/x-www-form-urlencoded'
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 
 			req = @request_factory.get( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/marlon_brando/2' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.put( '/api/v1/somewhere' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 
 		end
 
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/strong' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/stri' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/string/long' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 		end
 
 		it "allows negative auth criteria to be declared with a regexp" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/stri' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/stro' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/string' ) # not right-bound
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/string/long' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/other/string/long' ) # Not left-bound
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/chat' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 		end
 
 		it "allows negative auth criteria to be declared with a string and a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 			req = @request_factory.get( '/api/v1/strong' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.post( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.put( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.delete( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.options( '/api/v1/string' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 		end
 
 		it "allows negative auth criteria to be declared with a regexp and a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/regexp' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/regexp/a_username' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/regexp/%20not+a+username' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/regexp/guest' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 		end
 
 		it "allows negative auth criteria to be declared with just a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/foom' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.post( '/api/v1/foom', :accept => 'text/plain, text/html; q=0.5' )
-			app.request_should_auth?( req ).should be_true()
+			expect( app.request_should_auth?(req) ).to be_true()
 			req = @request_factory.get( '/api/v1/foom', :accept => 'text/plain, text/html; q=0.5' )
-			app.request_should_auth?( req ).should be_false()
+			expect( app.request_should_auth?(req) ).to be_false()
 
 		end
 
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/string' )
-			app.required_perms_for( req ).should == [ :stringperm ]
+			expect( app.required_perms_for(req) ).to eq( [ :stringperm ] )
 			req = @request_factory.get( '/api/v1/strong' )
-			app.required_perms_for( req ).should == []
+			expect( app.required_perms_for(req) ).to eq( [] )
 		end
 
 		it "allows perms criteria to be declared with a regexp" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/admin' )
-			app.required_perms_for( req ).should == [ :admin ]
+			expect( app.required_perms_for(req) ).to eq( [ :admin ] )
 			req = @request_factory.get( '/api/v1/admin/grant' )
-			app.required_perms_for( req ).should == [ :admin, :grant ]
+			expect( app.required_perms_for(req) ).to eq( [ :admin, :grant ] )
 			req = @request_factory.get( '/api/v1/users' )
-			app.required_perms_for( req ).should == []
+			expect( app.required_perms_for(req) ).to eq( [] )
 			req = @request_factory.get( '/api/v1/users/grant' )
-			app.required_perms_for( req ).should == [ :grant ]
+			expect( app.required_perms_for(req) ).to eq( [ :grant ] )
 		end
 
 		it "allows perms criteria to be declared with a string and a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/string' )
-			app.required_perms_for( req ).should == [ :stringperm, :otherperm ]
+			expect( app.required_perms_for(req) ).to eq( [ :stringperm, :otherperm ] )
 			req = @request_factory.get( '/api/v1/strong' )
-			app.required_perms_for( req ).should == []
+			expect( app.required_perms_for(req) ).to eq( [] )
 		end
 
 		it "allows multiple perms criteria for the same path" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1' )
-			app.required_perms_for( req ).should == [ :it_assets_webapp ]
+			expect( app.required_perms_for(req) ).to eq( [ :it_assets_webapp ] )
 			req = @request_factory.post( '/api/v1' )
-			app.required_perms_for( req ).should == [ :it_assets_webapp, :@sysadmin ]
+			expect( app.required_perms_for(req) ).to eq( [ :it_assets_webapp, :@sysadmin ] )
 			req = @request_factory.get( '/api/v1/users' )
-			app.required_perms_for( req ).should == [ :it_assets_webapp ]
+			expect( app.required_perms_for(req) ).to eq( [ :it_assets_webapp ] )
 			req = @request_factory.post( '/api/v1/users' )
-			app.required_perms_for( req ).should == [ :it_assets_webapp, :@sysadmin ]
+			expect( app.required_perms_for(req) ).to eq( [ :it_assets_webapp, :@sysadmin ] )
 		end
 
 		it "allows perms criteria to be declared with a regexp and a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/user' )
-			app.required_perms_for( req ).should == [ :admin ]
+			expect( app.required_perms_for(req) ).to eq( [ :admin ] )
 			req = @request_factory.get( '/api/v1/user/jzero' )
-			app.required_perms_for( req ).should == [ :admin ]
+			expect( app.required_perms_for(req) ).to eq( [ :admin ] )
 			req = @request_factory.get( '/api/v1/user/madeline' )
-			app.required_perms_for( req ).should == [ :admin, :superuser ]
+			expect( app.required_perms_for(req) ).to eq( [ :admin, :superuser ] )
 		end
 
 		it "allows perms the same as the appid to be declared with just a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/accounts' )
-			app.required_perms_for( req ).should == []
+			expect( app.required_perms_for(req) ).to eq( [] )
 			req = @request_factory.post( '/api/v1/accounts', '' )
-			app.required_perms_for( req ).should == [ :auth_test ]
+			expect( app.required_perms_for(req) ).to eq( [ :auth_test ] )
 			req = @request_factory.put( '/api/v1/accounts/1', '' )
-			app.required_perms_for( req ).should == [ :auth_test ]
+			expect( app.required_perms_for(req) ).to eq( [ :auth_test ] )
 		end
 
 		it "allows negative perms criteria to be declared with a string" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/string' )
-			app.required_perms_for( req ).should be_empty()
+			expect( app.required_perms_for(req) ).to be_empty()
 			req = @request_factory.get( '/api/v1/strong' )
-			app.required_perms_for( req ).should == [ :auth_test ] # default == appid
+			expect( app.required_perms_for(req) ).to eq([ :auth_test ]) # default == appid
 		end
 
 		it "allows negative perms criteria to be declared with a regexp" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/signup' )
-			app.required_perms_for( req ).should be_empty()
+			expect( app.required_perms_for(req) ).to be_empty()
 			req = @request_factory.get( '/api/v1/signup/reapply' )
-			app.required_perms_for( req ).should be_empty()
+			expect( app.required_perms_for(req) ).to be_empty()
 			req = @request_factory.get( '/api/v1/index' )
-			app.required_perms_for( req ).should == [ :auth_test ]
+			expect( app.required_perms_for(req) ).to eq( [ :auth_test ] )
 		end
 
 		it "allows negative perms criteria to be declared with a string and a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1' )
-			app.required_perms_for( req ).should be_empty()
+			expect( app.required_perms_for(req) ).to be_empty()
 			req = @request_factory.post( '/api/v1' )
-			app.required_perms_for( req ).should == [ :auth_test ] # default == appid
+			expect( app.required_perms_for(req) ).to eq([ :auth_test ]) # default == appid
 			req = @request_factory.get( '/api/v1/users' )
-			app.required_perms_for( req ).should == [ :auth_test ]
+
+			expect( app.required_perms_for(req) ).to eq( [ :auth_test ] )
 		end
 
 		it "allows negative perms criteria to be declared with a regexp and a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/collection' )
-			app.required_perms_for( req ).should == [ :auth_test ]
+			expect( app.required_perms_for(req) ).to eq( [ :auth_test ] )
 			req = @request_factory.get( '/api/v1/collection/degasse' )
-			app.required_perms_for( req ).should be_empty()
+			expect( app.required_perms_for(req) ).to be_empty()
 			req = @request_factory.get( '/api/v1/collection/ione' )
-			app.required_perms_for( req ).should be_empty()
+			expect( app.required_perms_for(req) ).to be_empty()
 			req = @request_factory.get( '/api/v1/collection/champhion' )
-			app.required_perms_for( req ).should be_empty()
+			expect( app.required_perms_for(req) ).to be_empty()
 			req = @request_factory.get( '/api/v1/collection/calindra' )
-			app.required_perms_for( req ).should == [ :auth_test ]
+			expect( app.required_perms_for(req) ).to eq( [ :auth_test ] )
 		end
 
 		it "allows negative perms criteria to be declared with just a block" do
 			app = @app.new
 
 			req = @request_factory.get( '/api/v1/collection', x_forwarded_for: '10.0.1.68' )
-			app.required_perms_for( req ).should be_empty()
+			expect( app.required_perms_for(req) ).to be_empty()
 			req = @request_factory.get( '/api/v1/collection', x_forwarded_for: '192.0.43.10' )
-			app.required_perms_for( req ).should == [ :auth_test ]
+			expect( app.required_perms_for(req) ).to eq( [ :auth_test ] )
 		end
 
 
 					req = @request_factory.get( '/api/v1/onlyperms' )
 
 					app = @app.new
-					app.auth_provider.should_not_receive( :authenticate )
-					app.auth_provider.should_receive( :authorize )
+					expect( app.auth_provider ).to_not receive( :authenticate )
+					expect( app.auth_provider ).to receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/onlyauth' )
 
 					app = @app.new
-					app.auth_provider.should_receive( :authenticate )
-					app.auth_provider.should_not_receive( :authorize )
+					expect( app.auth_provider ).to receive( :authenticate )
+					expect( app.auth_provider ).to_not receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/both' )
 
 					app = @app.new
-					app.auth_provider.should_receive( :authenticate )
-					app.auth_provider.should_receive( :authorize )
+					expect( app.auth_provider ).to receive( :authenticate )
+					expect( app.auth_provider ).to receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/neither' )
 
 					app = @app.new
-					app.auth_provider.should_not_receive( :authenticate )
-					app.auth_provider.should_not_receive( :authorize )
+					expect( app.auth_provider ).to_not receive( :authenticate )
+					expect( app.auth_provider ).to_not receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/onlyperms' )
 
 					app = @app.new
-					app.auth_provider.should_not_receive( :authenticate )
-					app.auth_provider.should_not_receive( :authorize )
+					expect( app.auth_provider ).to_not receive( :authenticate )
+					expect( app.auth_provider ).to_not receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/onlyauth' )
 
 					app = @app.new
-					app.auth_provider.should_receive( :authenticate )
-					app.auth_provider.should_receive( :authorize )
+					expect( app.auth_provider ).to receive( :authenticate )
+					expect( app.auth_provider ).to receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/both' )
 
 					app = @app.new
-					app.auth_provider.should_receive( :authenticate )
-					app.auth_provider.should_not_receive( :authorize )
+					expect( app.auth_provider ).to receive( :authenticate )
+					expect( app.auth_provider ).to_not receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/neither' )
 
 					app = @app.new
-					app.auth_provider.should_not_receive( :authenticate )
-					app.auth_provider.should_receive( :authorize )
+					expect( app.auth_provider ).to_not receive( :authenticate )
+					expect( app.auth_provider ).to receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/onlyperms' )
 
 					app = @app.new
-					app.auth_provider.should_receive( :authenticate )
-					app.auth_provider.should_receive( :authorize )
+					expect( app.auth_provider ).to receive( :authenticate )
+					expect( app.auth_provider ).to receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/onlyauth' )
 
 					app = @app.new
-					app.auth_provider.should_not_receive( :authenticate )
-					app.auth_provider.should_not_receive( :authorize )
+					expect( app.auth_provider ).to_not receive( :authenticate )
+					expect( app.auth_provider ).to_not receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/both' )
 
 					app = @app.new
-					app.auth_provider.should_not_receive( :authenticate )
-					app.auth_provider.should_receive( :authorize )
+					expect( app.auth_provider ).to_not receive( :authenticate )
+					expect( app.auth_provider ).to receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/neither' )
 
 					app = @app.new
-					app.auth_provider.should_receive( :authenticate )
-					app.auth_provider.should_not_receive( :authorize )
+					expect( app.auth_provider ).to receive( :authenticate )
+					expect( app.auth_provider ).to_not receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/onlyperms' )
 
 					app = @app.new
-					app.auth_provider.should_receive( :authenticate )
-					app.auth_provider.should_not_receive( :authorize )
+					expect( app.auth_provider ).to receive( :authenticate )
+					expect( app.auth_provider ).to_not receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/onlyauth' )
 
 					app = @app.new
-					app.auth_provider.should_not_receive( :authenticate )
-					app.auth_provider.should_receive( :authorize )
+					expect( app.auth_provider ).to_not receive( :authenticate )
+					expect( app.auth_provider ).to receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/both' )
 
 					app = @app.new
-					app.auth_provider.should_not_receive( :authenticate )
-					app.auth_provider.should_not_receive( :authorize )
+					expect( app.auth_provider ).to_not receive( :authenticate )
+					expect( app.auth_provider ).to_not receive( :authorize )
 
 					app.handle( req )
 				end
 					req = @request_factory.get( '/api/v1/neither' )
 
 					app = @app.new
-					app.auth_provider.should_receive( :authenticate )
-					app.auth_provider.should_receive( :authorize )
+					expect( app.auth_provider ).to receive( :authenticate )
+					expect( app.auth_provider ).to receive( :authorize )
 
 					app.handle( req )
 				end
 				req = @request_factory.get( '/api/v1/admin/upload' )
 
 				app = @app.new
-				app.auth_provider.stub!( :authenticate ).and_return( :credentials )
-				app.auth_provider.should_receive( :authorize ).with( :credentials, req, [:admin, :upload] )
+				allow( app.auth_provider ).to receive( :authenticate ).and_return( :credentials )
+				expect( app.auth_provider ).to receive( :authorize ).with( :credentials, req, [:admin, :upload] )
 
 				app.handle( req )
 			end

spec/strelka/app/errors_spec.rb

 # vim: set nosta noet ts=4 sw=4:
 # encoding: utf-8
 
-BEGIN {
-	require 'pathname'
-	basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
-	$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
-}
+require_relative '../../helpers'
 
 require 'rspec'
 require 'inversion'
 
-require 'spec/lib/helpers'
-
 require 'strelka'
 require 'strelka/plugins'
 require 'strelka/app/errors'
 				'blap'
 			end
 			subclass = Class.new( @app )
-			subclass.status_handlers.should == @app.status_handlers
-			subclass.status_handlers.should_not equal( @app.status_handlers )
+			expect( subclass.status_handlers ).to eq( @app.status_handlers )
+			expect( subclass.status_handlers ).to_not equal( @app.status_handlers )
 		end
 
 		it "doesn't alter normal responses" do
 			req = @request_factory.get( '/koolaid' )
 			res = @app.new.handle( req )
 
-			res.status.should == HTTP::OK
+			expect( res.status ).to eq( HTTP::OK )
 			res.body.rewind
-			res.body.read.should == "Oh yeah! Kool-Aid!\n"
+			expect( res.body.read ).to eq( "Oh yeah! Kool-Aid!\n" )
 		end
 
 		it "raises an error if a handler is declared with both a template and a block" do
 			res = @app.new.handle( req )
 
 			res.body.rewind
-			res.body.read.should =~ /internal server error/i
+			expect( res.body.read ).to match( /internal server error/i )
 		end
 
 		it "calls a callback-style handler for any status when finished with BAD_REQUEST" do
 			req = @request_factory.get( '/foom' )
 			res = @app.new.handle( req )
 
-			res.status.should == HTTP::BAD_REQUEST
+			expect( res.status ).to eq( HTTP::BAD_REQUEST )
 			res.body.rewind
-			res.body.read.should == '(400) Filthy banana'
+			expect( res.body.read ).to eq( '(400) Filthy banana' )
 		end
 
 
 			res = @app.new.handle( req )
 
 			res.body.rewind
-			res.body.read.should == 'NOPE!'
+			expect( res.body.read ).to eq( 'NOPE!' )
 		end
 
 
 			res = @app.new.handle( req )
 
 			res.body.rewind
-			res.body.read.should == 'Error:  JAMBA'
+			expect( res.body.read ).to eq( 'Error:  JAMBA' )
 		end
 
 		it "sets the error status info in the transaction notes when the response is handled by a status-handler" do
 			req = @request_factory.get( '/foom' )
 			res = @app.new.handle( req )
 
-			res.notes[:status_info].should include( :status, :message, :headers )
-			res.notes[:status_info][:status].should == HTTP::BAD_REQUEST
-			res.notes[:status_info][:message].should == "Your sandwich is missing something."
+			expect( res.notes[:status_info] ).to include( :status, :message, :headers )
+			expect( res.notes[:status_info][:status] ).to eq( HTTP::BAD_REQUEST )
+			expect( res.notes[:status_info][:message] ).to eq( "Your sandwich is missing something." )
 		end
 
 		it "provides its own exception handler for the request phase" do
 			req = @request_factory.get( '/foom' )
 			res = @app.new.handle( req )
 
-			res.notes[:status_info].should include( :status, :message, :headers, :exception )
-			res.notes[:status_info][:status].should == HTTP::SERVER_ERROR
-			res.notes[:status_info][:message].should == "An uncaught exception"
-			res.notes[:status_info][:exception].should be_a( RuntimeError )
+			expect( res.notes[:status_info] ).to include( :status, :message, :headers, :exception )
+			expect( res.notes[:status_info][:status] ).to eq( HTTP::SERVER_ERROR )
+			expect( res.notes[:status_info][:message] ).to eq( "An uncaught exception" )
+			expect( res.notes[:status_info][:exception] ).to be_a( RuntimeError )
 			res.body.rewind
-			res.body.read.should == "RuntimeError"
+			expect( res.body.read ).to eq( "RuntimeError" )
 		end
 
 
 				res = @app.new.handle( req )
 
 				res.body.rewind
-				res.body.read.should =~ /error-handler template/i
+				expect( res.body.read ).to match( /error-handler template/i )
 			end
 		end
 

spec/strelka/app/filters_spec.rb

 # vim: set nosta noet ts=4 sw=4:
 # encoding: utf-8
 
-BEGIN {
-	require 'pathname'
-	basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
-	$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
-}
+require_relative '../../helpers'
 
 require 'rspec'
 
-require 'spec/lib/helpers'
-
 require 'strelka'
 require 'strelka/plugins'
 require 'strelka/app/filters'
 			end
 			subclass = Class.new( @app )
 
-			subclass.filters.should == @app.filters
-			subclass.filters.should_not equal( @app.filters )
-			subclass.filters[:request].should_not equal( @app.filters[:request] )
-			subclass.filters[:response].should_not equal( @app.filters[:response] )
-			subclass.filters[:both].should_not equal( @app.filters[:both] )
+			expect( subclass.filters ).to eq( @app.filters )
+			expect( subclass.filters ).to_not equal( @app.filters )
+			expect( subclass.filters[:request] ).to_not equal( @app.filters[:request] )
+			expect( subclass.filters[:response] ).to_not equal( @app.filters[:response] )
+			expect( subclass.filters[:both] ).to_not equal( @app.filters[:both] )
 		end
 
 		it "has a Hash of filters" do
-			@app.filters.should be_a( Hash )
+			expect( @app.filters ).to be_a( Hash )
 		end
 
 
 		describe "that doesn't declare any filters" do
 
 			it "doesn't have any request filters" do
-				@app.request_filters.should be_empty()
+				expect( @app.request_filters ).to be_empty()
 			end
 
 			it "doesn't have any response filters" do
-				@app.response_filters.should be_empty()
+				expect( @app.response_filters ).to be_empty()
 			end
 
 		end
 
 
 			it "has a single request filter" do
-				@app.request_filters.should have(1).member
+				expect( @app.request_filters ).to have(1).member
 			end
 
 			it "has a single response filter" do
-				@app.response_filters.should have(1).member
+				expect( @app.response_filters ).to have(1).member
 			end
 
 			it "passes both the request and the response through it" do
 
 				res = @app.new.handle( req )
 
-				req.notes[:saw][:request].should be_true()
-				res.notes[:saw][:response].should be_true()
+				expect( req.notes[:saw][:request] ).to be_true()
+				expect( res.notes[:saw][:response] ).to be_true()
 			end
 
 		end
 
 
 			it "has a single request filter" do
-				@app.request_filters.should have(1).member
+				expect( @app.request_filters ).to have(1).member
 			end
 
 			it "has no response filters" do
-				@app.response_filters.should be_empty()
+				expect( @app.response_filters ).to be_empty()
 			end
 
 			it "passes just the request through it" do
 
 				res = @app.new.handle( req )
 
-				req.notes[:saw][:request].should be_true()
-				res.notes[:saw][:response].should be_nil()
+				expect( req.notes[:saw][:request] ).to be_true()
+				expect( res.notes[:saw][:response] ).to be_nil()
 			end
 
 		end
 
 
 			it "has no request filters" do
-				@app.request_filters.should be_empty()
+				expect( @app.request_filters ).to be_empty()
 			end
 
 			it "has no response filters" do
-				@app.response_filters.should have(1).member
+				expect( @app.response_filters ).to have(1).member
 			end
 
 			it "passes just the response through it" do
 
 				res = @app.new.handle( req )
 
-				req.notes[:saw][:request].should be_nil()
-				res.notes[:saw][:response].should be_true()
+				expect( req.notes[:saw][:request] ).to be_nil()
+				expect( res.notes[:saw][:response] ).to be_true()
 			end
 
 		end

spec/strelka/app/negotiation_spec.rb

 # vim: set nosta noet ts=4 sw=4:
 # encoding: utf-8
 
-BEGIN {
-	require 'pathname'
-	basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
-	$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
-}
+require_relative '../../helpers'
 
 require 'rspec'
 
-require 'spec/lib/helpers'
-
 require 'strelka'
 require 'strelka/plugins'
 require 'strelka/app/negotiation'
 		it "gets requests that have been extended with content-negotiation" do
 			req = @request_factory.get( '/service/user/estark' )
 			@app.new.handle( req )
-			req.singleton_class.included_modules.
-				should include( Strelka::HTTPRequest::Negotiation )
+			expect( req.singleton_class.included_modules ).
+				to include( Strelka::HTTPRequest::Negotiation )
 		end
 
 		it "gets responses that have been extended with content-negotiation" do
 			req = @request_factory.get( '/service/user/estark' )
 			res = @app.new.handle( req )
-			res.singleton_class.included_modules.
-				should include( Strelka::HTTPResponse::Negotiation )
+			expect( res.singleton_class.included_modules ).
+				to include( Strelka::HTTPResponse::Negotiation )
 		end
 
 		it "adds custom content-type transforms to outgoing responses" do
 			req = @request_factory.get( '/service/user/astark', :accept => 'text/x-tnetstring' )
 			res = @app.new.handle( req )
-			res.content_type.should == 'text/x-tnetstring'
-			res.body.read.should == '28:2:an,19:5:array,8:of stuff,}]'
+			expect( res.content_type ).to eq( 'text/x-tnetstring' )
+			expect( res.body.read ).to eq( '28:2:an,19:5:array,8:of stuff,}]' )
 		end
 
 	end

spec/strelka/app/parameters_spec.rb

 # vim: set nosta noet ts=4 sw=4:
 # encoding: utf-8
 
-BEGIN {
-	require 'pathname'
-	basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
-	$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
-}
+require_relative '../../helpers'
 
 require 'rspec'
 
-require 'spec/lib/helpers'
-
 require 'strelka'
 require 'strelka/plugins'
 require 'strelka/app/parameters'
 			@app.param :string
 			subclass = Class.new( @app )
 
-			subclass.paramvalidator.param_names.should == @app.paramvalidator.param_names
-			subclass.paramvalidator.should_not equal( @app.paramvalidator )
+			expect( subclass.paramvalidator.param_names ).to eq( @app.paramvalidator.param_names )
+			expect( subclass.paramvalidator ).to_not equal( @app.paramvalidator )
 		end
 
 		it "has a ParamValidator" do
-			@app.paramvalidator.should be_a( Strelka::ParamValidator )
+			expect( @app.paramvalidator ).to be_a( Strelka::ParamValidator )
 		end
 
 		it "can declare a parameter with a regular-expression constraint" do
 				param :username, /\w+/i
 			end
 
-			@app.paramvalidator.param_names.should == [ 'username' ]
+			expect( @app.paramvalidator.param_names ).to eq( [ 'username' ] )
 		end
 
 		it "can declare a parameter with a builtin constraint" do
 				param :comment_body, :printable
 			end
 
-			@app.paramvalidator.param_names.should == [ 'comment_body' ]
+			expect( @app.paramvalidator.param_names ).to eq( [ 'comment_body' ] )
 		end
 
 		it "can declare a parameter with a Proc constraint" do
 				end
 			end
 
-			@app.paramvalidator.param_names.should == [ 'start_time' ]
+			expect( @app.paramvalidator.param_names ).to eq( [ 'start_time' ] )
 		end
 
 
 				end
 			end
 
-			@app.paramvalidator.param_names.should == [ 'created_at' ]
+			expect( @app.paramvalidator.param_names ).to eq( [ 'created_at' ] )
 		end
 
 
 			end
 			subapp = Class.new( @app )
 
-			subapp.paramvalidator.param_names.should == [ 'username' ]
+			expect( subapp.paramvalidator.param_names ).to eq( [ 'username' ] )
 		end
 
 		describe "instance" do
 				req = @request_factory.get( '/user/search' )
 				@app.new.handle( req )
 
-				req.params.should be_a( Strelka::ParamValidator )
-				req.params.should have_errors()
-				req.params.error_messages.should == ["Missing value for 'Username'"]
+				expect( req.params ).to be_a( Strelka::ParamValidator )
+				expect( req.params ).to have_errors()
+				expect( req.params.error_messages ).to eq( ["Missing value for 'Username'"] )
 			end
 
 			it "validates parameters from the request" do
 				req = @request_factory.get( '/user/search?username=anheptoh'.taint )
 				@app.new.handle( req )
 
-				req.params.should be_a( Strelka::ParamValidator )
-				req.params.should be_okay()
-				req.params.should_not have_errors()
-				req.params[:username].should == 'anheptoh'
-				req.params[:username].should be_tainted()
+				expect( req.params ).to be_a( Strelka::ParamValidator )
+				expect( req.params ).to be_okay()
+				expect( req.params ).to_not have_errors()
+				expect( req.params[:username] ).to eq( 'anheptoh' )
+				expect( req.params[:username] ).to be_tainted()
 			end
 
 			it "untaints all parameters if global untainting is enabled" do
 					untaint_all_constraints true
 				end
 
-				@app.untaint_all_constraints.should be_true()
+				expect( @app.untaint_all_constraints ).to be_true()
 				req = @request_factory.get( '/user/search?username=shereshnaheth'.taint )
 				@app.new.handle( req )
 
-				req.params[:username].should == 'shereshnaheth'
-				req.params[:username].should_not be_tainted()
+				expect( req.params[:username] ).to eq( 'shereshnaheth' )
+				expect( req.params[:username] ).to_not be_tainted()
 			end
 
 			it "untaints parameters flagged for untainting" do
 				req = @request_factory.get( '/user/search?message=I+love+the+circus.'.taint )
 				@app.new.handle( req )
 
-				req.params[:message].should_not be_tainted()
-				req.params[:message].should == 'I love the circus.'
+				expect( req.params[:message] ).to_not be_tainted()
+				expect( req.params[:message] ).to eq( 'I love the circus.' )
 			end
 
 		end

spec/strelka/app/restresources_spec.rb

 # vim: set nosta noet ts=4 sw=4:
 # encoding: utf-8
 
-BEGIN {
-	require 'pathname'
-	basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
-	$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
-}
+require_relative '../../helpers'
 
 require 'rspec'
 
-require 'spec/lib/helpers'
-
 require 'strelka'
 require 'strelka/plugins'
 require 'strelka/app/restresources'
 
 
 		it "keeps track of what resources are mounted where" do
-			@app.resource_verbs.should be_a( Hash )
-			@app.resource_verbs.should be_empty()
+			expect( @app.resource_verbs ).to be_a( Hash )
+			expect( @app.resource_verbs ).to be_empty()
 		end
 
 
 			end
 
 			it "keeps track of what resources are mounted where" do
-				@app.resource_verbs.should have( 1 ).member
-				@app.resource_verbs.should include( 'servers' )
+				expect( @app.resource_verbs ).to have( 1 ).member
+				expect( @app.resource_verbs ).to include( 'servers' )
 				@app.resource_verbs[ 'servers' ].
 					should include( :OPTIONS, :GET, :HEAD, :POST, :PUT, :DELETE )
 			end
 			end
 
 			it "keeps track of what resources are mounted where" do
-				@app.resource_verbs.should have( 1 ).member
-				@app.resource_verbs.should include( 'servers' )
+				expect( @app.resource_verbs ).to have( 1 ).member
+				expect( @app.resource_verbs ).to include( 'servers' )
 				@app.resource_verbs[ 'servers' ].
 					should include( :OPTIONS, :GET, :HEAD )
 				@app.resource_verbs[ 'servers' ].
 					req = @request_factory.options( '/api/v1/servers' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
-					res.headers.allowed.split( /\s*,\s*/ ).should include(*%w[GET HEAD POST PUT DELETE])
+					expect( res.status ).to eq( HTTP::OK )
+					expect( res.headers.allowed.split( /\s*,\s*/ ) ).to include(*%w[GET HEAD POST PUT DELETE])
 				end
 
 			end # OPTIONS routes
 					req = @request_factory.get( '/api/v1/servers', 'Accept' => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.content_type.should == 'application/json'
+					expect( res.content_type ).to eq( 'application/json' )
 					body = Yajl.load( res.body )
 
-					body.should have( 2 ).members
-					body.map {|record| record['uuid'] }.should include( 'test-server', 'step-server' )
+					expect( body ).to have( 2 ).members
+					expect( body.map {|record| record['uuid'] } ).to include( 'test-server', 'step-server' )
 				end
 
 				it "supports limiting the result set when fetching the resource collection" do
 						'Accept' => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
-					res.content_type.should == 'application/json'
+					expect( res.status ).to eq( HTTP::OK )
+					expect( res.content_type ).to eq( 'application/json' )
 					body = Yajl.load( res.body )
 
-					body.should have( 1 ).member
-					body[0]['uuid'].should == 'test-server'
+					expect( body ).to have( 1 ).member
+					expect( body[0]['uuid'] ).to eq( 'test-server' )
 				end
 
 				it "supports paging the result set when fetching the resource collection" do
 						'Accept' => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
-					res.content_type.should == 'application/json'
+					expect( res.status ).to eq( HTTP::OK )
+					expect( res.content_type ).to eq( 'application/json' )
 					body = Yajl.load( res.body )
 
-					body.should have( 1 ).member
-					body[0]['uuid'].should == 'step-server'
+					expect( body ).to have( 1 ).member
+					expect( body[0]['uuid'] ).to eq( 'step-server' )
 				end
 
 				it "supports ordering the result by a single column" do
 						'Accept' => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
-					res.content_type.should == 'application/json'
+					expect( res.status ).to eq( HTTP::OK )
+					expect( res.content_type ).to eq( 'application/json' )
 					body = Yajl.load( res.body )
 
-					body.should have( 2 ).members
-					body[0]['name'].should == 'Step'
+					expect( body ).to have( 2 ).members
+					expect( body[0]['name'] ).to eq( 'Step' )
 				end
 
 				it "supports ordering the result by multiple columns" do
 						 'Accept' => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
-					res.content_type.should == 'application/json'
+					expect( res.status ).to eq( HTTP::OK )
+					expect( res.content_type ).to eq( 'application/json' )
 					body = Yajl.load( res.body )
 
-					body.should have( 2 ).members
-					body[0]['name'].should == 'Test'
+					expect( body ).to have( 2 ).members
+					expect( body[0]['name'] ).to eq( 'Test' )
 				end
 
 				it "has a GET route to fetch a single resource by its ID" do
 					req = @request_factory.get( '/api/v1/servers/1', 'Accept' => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.content_type.should == 'application/json'
+					expect( res.content_type ).to eq( 'application/json' )
 					body = Yajl.load( res.body )
 
-					body.should be_a( Hash )
-					body['uuid'].should == 'test-server'
+					expect( body ).to be_a( Hash )
+					expect( body['uuid'] ).to eq( 'test-server' )
 				end
 
 				it "returns a NOT FOUND response when fetching a non-existant resource" do
 					req = @request_factory.get( '/api/v1/servers/411', 'Accept' => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::NOT_FOUND
+					expect( res.status ).to eq( HTTP::NOT_FOUND )
 					res.body.rewind
-					res.body.read.should =~ /no such server/i
+					expect( res.body.read ).to match( /no such server/i )
 				end
 
 				it "returns a NOT FOUND response when fetching a resource with an invalid ID" do
 					req = @request_factory.get( '/api/v1/servers/ape-tastic' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::NOT_FOUND
+					expect( res.status ).to eq( HTTP::NOT_FOUND )
 					res.body.rewind
-					res.body.read.should =~ /requested resource was not found/i
+					expect( res.body.read ).to match( /requested resource was not found/i )
 				end
 
 				it "has a GET route for fetching the resource via one of its dataset methods" do
 						 :accept => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
+					expect( res.status ).to eq( HTTP::OK )
 					body = Yajl.load( res.body )
 
-					body.should be_an( Array )
-					body.should have( 1 ).member
-					body.first.should be_a( Hash )
-					body.first['uuid'].should == 'test-server'
+					expect( body ).to be_an( Array )
+					expect( body ).to have( 1 ).member
+					expect( body.first ).to be_a( Hash )
+					expect( body.first['uuid'] ).to eq( 'test-server' )
 				end
 
 				it "has a GET route for fetching the resource via a subset" do
 						:accept => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
+					expect( res.status ).to eq( HTTP::OK )
 					body = Yajl.load( res.body )
 
-					body.should be_an( Array )
-					body.should have( 1 ).member
-					body.first.should be_a( Hash )
-					body.first['port'].should > 1024
+					expect( body ).to be_an( Array )
+					expect( body ).to have( 1 ).member
+					expect( body.first ).to be_a( Hash )
+					expect( body.first['port'] ).to be > 1024
 				end
 
 				it "has a GET route for methods declared in a named dataset module" do
 						 :accept => 'application/json' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
+					expect( res.status ).to eq( HTTP::OK )
 					body = Yajl.load( res.body )
 
-					body.should be_an( Array )
-					body.should have( 1 ).member
-					body.first.should be_a( Hash )
-					body.first['name'].should == 'Step'
+					expect( body ).to be_an( Array )
+					expect( body ).to have( 1 ).member
+					expect( body.first ).to be_a( Hash )
+					expect( body.first['name'] ).to eq( 'Step' )
 				end
 
 
 					req = @request_factory.get( '/api/v1/servers/1/hosts' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
+					expect( res.status ).to eq( HTTP::OK )
 					body = Yajl.load( res.body )
 
-					body.should be_an( Array )
-					body.should have( 4 ).members
-					body.first.should be_a( Hash )
-					body.first['server_id'].should == 1
-					body.first['id'].should == 1
+					expect( body ).to be_an( Array )
+					expect( body ).to have( 4 ).members
+					expect( body.first ).to be_a( Hash )
+					expect( body.first['server_id'] ).to eq( 1 )
+					expect( body.first['id'] ).to eq( 1 )
 				end
 
 				it "supports offset and limits for composite GET routes" do
 					req = @request_factory.get( '/api/v1/servers/1/hosts?offset=2;limit=2' )
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::OK
+					expect( res.status ).to eq( HTTP::OK )
 					body = Yajl.load( res.body )
 
-					body.should be_an( Array )
-					body.should have( 2 ).members
-					body.first.should be_a( Hash )
-					body.first['server_id'].should == 1
-					body.first['id'].should == 3
+					expect( body ).to be_an( Array )
+					expect( body ).to have( 2 ).members
+					expect( body.first ).to be_a( Hash )
+					expect( body.first['server_id'] ).to eq( 1 )
+					expect( body.first['id'] ).to eq( 3 )
 				end
 
 			end # GET routes
 
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::CREATED
-					res.headers.location.should == 'http://localhost:8080/api/v1/servers/3'
+					expect( res.status ).to eq( HTTP::CREATED )
+					expect( res.headers.location ).to eq( 'http://localhost:8080/api/v1/servers/3' )
 
 					new_server = Mongrel2::Config::Server[ 3 ]
 
-					new_server.uuid.should         == "test-server"
-					new_server.access_log.should   == "/logs/admin-access.log"
-					new_server.error_log.should    == "/logs/admin-error.log"
-					new_server.chroot.should       == "/var/www"
-					new_server.pid_file.should     == "/var/run/test.pid"
-					new_server.default_host.should == "localhost"
-					new_server.name.should         == "Testing Server"
-					new_server.bind_addr.should    == "127.0.0.1"
-					new_server.port.should         == 7337
-					new_server.use_ssl.should      == 0
+					expect( new_server.uuid ).to         eq( "test-server" )
+					expect( new_server.access_log ).to   eq( "/logs/admin-access.log" )
+					expect( new_server.error_log ).to    eq( "/logs/admin-error.log" )
+					expect( new_server.chroot ).to       eq( "/var/www" )
+					expect( new_server.pid_file ).to     eq( "/var/run/test.pid" )
+					expect( new_server.default_host ).to eq( "localhost" )
+					expect( new_server.name ).to         eq( "Testing Server" )
+					expect( new_server.bind_addr ).to    eq( "127.0.0.1" )
+					expect( new_server.port ).to         eq( 7337 )
+					expect( new_server.use_ssl ).to      eq( 0 )
 				end
 
+				it "has a POST route to update instances"
+
 			end # POST routes
 
 
 					}
 				end
 
-				it "has a PUT route to update instances in the resource collection" do
+				it "has a PUT route to replace instances in the resource collection" do
 					req = @request_factory.put( '/api/v1/servers/1' )
 					req.content_type = 'application/json'
 					req.headers.accept = 'application/json'
 
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::NO_CONTENT
+					expect( res.status ).to eq( HTTP::NO_CONTENT )
 
-					Mongrel2::Config::Server[ 1 ].name.should == 'Not A Testing Server'
-					Mongrel2::Config::Server[ 1 ].bind_addr.should == '0.0.0.0'
+					expect( Mongrel2::Config::Server[ 1 ].name ).to eq( 'Not A Testing Server' )
+					expect( Mongrel2::Config::Server[ 1 ].bind_addr ).to eq( '0.0.0.0' )
 				end
 
-				it "has a PUT route to mass-update all resources in a collection" do
-					req = @request_factory.put( '/api/v1/servers' )
-					req.content_type = 'application/json'
-					req.body = Yajl.dump({ 'bind_addr' => '0.0.0.0' })
+				it "has a PUT route to replace all resources in a collection" do
+					pending "fix the semantics of PUT and POST" do
+						req = @request_factory.put( '/api/v1/servers' )
+						req.content_type = 'application/json'
+						req.body = Yajl.dump({ 'bind_addr' => '0.0.0.0' })
 
-					res = @app.new.handle( req )
+						res = @app.new.handle( req )
 
-					res.status.should == HTTP::NO_CONTENT
+						expect( res.status ).to eq( HTTP::NO_CONTENT )
 
-					Mongrel2::Config::Server.map( :bind_addr ).uniq.should == ['0.0.0.0']
+						expect( Mongrel2::Config::Server.map( :bind_addr ) ).to eq( ['0.0.0.0'] )
+					end
 				end
 
 			end # PUT routes
 
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::NO_CONTENT
+					expect( res.status ).to eq( HTTP::NO_CONTENT )
 
-					Mongrel2::Config::Server.count.should == 1
+					expect( Mongrel2::Config::Server.count ).to eq( 1 )
 				end
 
 				it "has a DELETE route to mass-delete all resources in a collection" do
 
 					res = @app.new.handle( req )
 
-					res.status.should == HTTP::NO_CONTENT
+					expect( res.status ).to eq( HTTP::NO_CONTENT )
 
-					Mongrel2::Config::Server.count.should == 0
+					expect( Mongrel2::Config::Server.count ).to eq( 0 )
 				end
 
 			end # DELETE routes
 
 
 			it "has its config inherited by subclass" do
-				subject.service_options.should == @app.service_options
-				subject.service_options.should_not be( @app.service_options )
+				expect( subject.service_options ).to eq( @app.service_options )
+				expect( subject.service_options ).to_not be( @app.service_options )
 			end
 
 			it "has its metadata inherited by subclasses" do
-				subject.resource_verbs.should have( 1 ).member
-				subject.resource_verbs.should include( 'servers' )
+				expect( subject.resource_verbs ).to have( 1 ).member
+				expect( subject.resource_verbs ).to include( 'servers' )
 				subject.resource_verbs[ 'servers' ].
 					should include( :OPTIONS, :GET, :HEAD, :POST, :PUT, :DELETE )
 			end

spec/strelka/app/routing_spec.rb

 # vim: set nosta noet ts=4 sw=4:
 # encoding: utf-8
 
-BEGIN {
-	require 'pathname'
-	basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
-	$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
-}
+require_relative '../../helpers'
 
 require 'rspec'
 
-require 'spec/lib/helpers'
-
 require 'strelka'
 require 'strelka/plugins'
 require 'strelka/app/routing'
 
 
 		it "has an Array of raw routes" do
-			@app.routes.should be_a( Array )
+			expect( @app.routes ).to be_a( Array )
 		end
 
 		it "knows what its route methods are" do
-			@app.route_methods.should == []
+			expect( @app.route_methods ).to eq( [] )
 			@app.class_eval do
 				get() {}
 				post( '/clowns' ) {}
 				options( '/clowns' ) {}
 			end
 
-			@app.route_methods.should == [ :GET, :POST_clowns, :OPTIONS_clowns ]
+			expect( @app.route_methods ).to eq( [ :GET, :POST_clowns, :OPTIONS_clowns ] )
 		end
 
 		# OPTIONS GET/HEAD POST PUT DELETE TRACE CONNECT
 
 		it "can declare a OPTIONS route" do
-			@app.routes.should be_empty()
+			expect( @app.routes ).to be_empty()
 
 			@app.class_eval do
 				options do |req|
 				end
 			end
 
-			@app.routes.should == [
+			expect( @app.routes ).to eq([
 				[ :OPTIONS, [], {action: @app.instance_method(:OPTIONS), options: {}} ]
-			]
+			])
 		end
 
 		it "can declare a GET route" do
-			@app.routes.should be_empty()
+			expect( @app.routes ).to be_empty()
 
 			@app.class_eval do
 				get do |req|
 				end
 			end
 
-			@app.routes.should == [
+			expect( @app.routes ).to eq([
 				[ :GET, [], {action: @app.instance_method(:GET), options: {}} ]
-			]
+			])
 		end
 
 		it "can declare a POST route" do
-			@app.routes.should be_empty()
+			expect( @app.routes ).to be_empty()
 
 			@app.class_eval do
 				post do |req|
 				end
 			end
 
-			@app.routes.should == [
+			expect( @app.routes ).to eq([
 				[ :POST, [], {action: @app.instance_method(:POST), options: {}} ]
-			]
+			])
 		end
 
 		it "can declare a PUT route" do
-			@app.routes.should be_empty()
+			expect( @app.routes ).to be_empty()
 
 			@app.class_eval do
 				put do |req|
 				end
 			end
 
-			@app.routes.should == [[ :PUT, [], {action: @app.instance_method(:PUT), options: {}} ]]
+			expect( @app.routes ).to eq([
+				[ :PUT, [], {action: @app.instance_method(:PUT), options: {}} ]
+			])
 		end
 
 		it "can declare a DELETE route" do
-			@app.routes.should be_empty()
+			expect( @app.routes ).to be_empty()
 
 			@app.class_eval do
 				delete do |req|
 				end
 			end
 
-			@app.routes.should == [
+			expect( @app.routes ).to eq([
 				[ :DELETE, [], {action: @app.instance_method(:DELETE), options: {}} ]
-			]
+			])
 		end
 
 		it "can declare a TRACE route" do
-			@app.routes.should be_empty()
+			expect( @app.routes ).to be_empty()
 
 			@app.class_eval do
 				trace do |req|
 				end
 			end
 
-			@app.routes.should == [
+			expect( @app.routes ).to eq([