Sha256: 98b012333cd5739d41605fd4c3b61f6b372104e0aa1f7d60af3841f102cce937
Contents?: true
Size: 956 Bytes
Versions: 1
Compression:
Stored size: 956 Bytes
Contents
module GeoRedirect module Support def fixture_path(file) "spec/fixtures/#{file}" end def nonexisting_file_path '/no_such_file' end def app Rack::Lint.new(@app) end def mock_app(options = {}) # Simple HTTP server that always returns 'Hello world!' main_app = lambda do |env| Rack::Request.new(env) headers = { 'Content-Type' => 'text/html' } [200, headers, ['Hello world!']] end @logfile = Tempfile.new('log') options = { config: fixture_path('config.yml'), db: fixture_path('GeoIP.dat'), logfile: @logfile.path }.merge(options) builder = Rack::Builder.new builder.use GeoRedirect::Middleware, options builder.run main_app @app = builder.to_app end def log_should_include(message) @logfile.rewind @logfile.read.should include(message) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geo_redirect-0.4 | spec/support/geo_redirect.rb |