Sha256: b429f7e881f5b90f268453a37a4c3e9645965cb9102c9ac7ca820cb9ebf4bcd4

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'focused_controller/test_helper'
require 'focused_controller/rspec_controller_class'

begin
  # Requiring specific files rather than just 'rspec/rails' because I don't
  # want to force the configuration that 'rspec/rails' adds on people if they
  # haven't specifically chosen to receive it.
  require 'rspec/rails/matchers'
  require 'rspec/rails/adapters'
rescue LoadError
end

module FocusedController
  module RSpecHelper
    def self.append_features(base)
      base.class_eval do
        # This must get included higher in the ancestor chain than
        # this module so that inheritance works as desired
        include FocusedController::TestHelper
        extend ClassMethods
        subject { controller }
      end

      super
    end

    if defined?(RSpec::Rails)
      include RSpec::Rails::SetupAndTeardownAdapter
      include RSpec::Rails::TestUnitAssertionAdapter
      include RSpec::Rails::Matchers
      include RSpec::Rails::Matchers::RedirectTo
      include RSpec::Rails::Matchers::RenderTemplate
    end

    module ClassMethods
      include FocusedController::RSpecControllerClass

      def stub_url(*helper_names)
        before { stub_url(*helper_names) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
focused_controller-1.1.1 lib/focused_controller/rspec_helper.rb
focused_controller-1.1.0 lib/focused_controller/rspec_helper.rb