Sha256: 5623d750f6d4e7b37106aa4cd9ac2774312530d0f00cb4fbd1f7c11dbf7ceefe

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

Contents

require 'rubygems'

require 'rails'
require 'rails/all'

require 'shhhhh'

class HomeController < ActionController::Base
  def index
    render :text => 'Hi there!'
  end
end

def request(uri)
  Rack::MockRequest.env_for(uri)
end

RSpec.describe Shhhhh::Middleware do
  before do
    @output = StringIO.new
    @app = Class.new(Rails::Application)
    @app.configure do

      config.active_support.deprecation = :notify
      config.secret_token = '1'*32
      config.eager_load = false

      routes {
        root :to => 'home#index'
        get 'assets/picture' => 'home#index'
      }
    end

    @app.initialize!
    Rails.logger = Logger.new(@output)
    Rails.logger.formatter = lambda { |s, d, p, m| "#{m}\n" }
    @app
  end

  it do
    @app.call request('/assets/picture')

    expect(@output.string).to eq ''
  end

  it do
    @app.call request('/')

    expect(@output.string).to include 'Started GET'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shhhhh-0.0.1 spec/lib/middleware_spec.rb