Sha256: 5c54426782c9c92084a4c5ae17535434e27ba55d8b4e7bb62037040061dd602d

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

require 'rspec'
require 'action_controller/railtie'
require 'gaffe'
require_relative './application_controller_helper'
require 'gaffe/errors_controller'

RSpec.configure do |config|
  # Disable `should` syntax
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  config.before(:each) do
    # Fake Rails.root
    allow(Rails).to receive(:root).and_return(RAILS_ROOT)

    # Fake Rails.application
    application = double('Rails Application', config: OpenStruct.new, env_config: {})
    allow(Rails).to receive(:application).and_return(application)

    # Make sure we clear memoized variables before each test
    [:@configuration].each do |variable|
      Gaffe.send :remove_instance_variable, variable if Gaffe.instance_variable_defined?(variable)
    end
  end
end

def test_request
  if Rails::VERSION::MAJOR >= 5
    ActionDispatch::TestRequest.create
  else
    ActionDispatch::TestRequest.new
  end
end

# We need Rails.root
RAILS_ROOT = Pathname.new(File.expand_path('../../', __FILE__))

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gaffe-1.2.0 spec/spec_helper.rb