Sha256: 454bde9119917f1c1c322b20c37f82ce0d2731296a7efe12bca2ac03af35dc4c

Contents?: true

Size: 940 Bytes

Versions: 7

Compression:

Stored size: 940 Bytes

Contents

require 'securerandom'
ENV['RACK_ENV'] = 'test'

if ENV['TRAVIS']
  require 'coveralls'
  Coveralls.wear!
else
  require 'simplecov'
  SimpleCov.start do
    add_filter "spec"
  end
end

require 'nyny'
include NYNY

class Rack::MockRequest
  def trace(uri, opts={})     request("TRACE", uri, opts)     end
  def options(uri, opts={})   request("OPTIONS", uri, opts)   end
end

def template name
  File.join(File.dirname(__FILE__), 'views', name)
end

def extended_modules_for kls
  (class << kls; self end).included_modules
end

def mock_app parent=App, &blk
  Rack::MockRequest.new mock_app_class(parent, &blk).new
end

def mock_app_class parent=App, &blk
  Class.new(parent, &blk)
end

def random_url levels=1
  parts = levels.times.map do
    SecureRandom.urlsafe_base64
  end

  "/#{parts.join('/')}"
end

class NullMiddleware
  def initialize app
    @app = app
  end

  def call env
    @app.call env
  end
end

module NullHelper
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nyny-3.4.0 spec/spec_helper.rb
nyny-3.3.1 spec/spec_helper.rb
nyny-3.3.0 spec/spec_helper.rb
nyny-3.2.2 spec/spec_helper.rb
nyny-3.2.1 spec/spec_helper.rb
nyny-3.2.0 spec/spec_helper.rb
nyny-3.1.0 spec/spec_helper.rb