Sha256: 92423c718b092392706db51157089df031f150daae316f5d1082d7f718de6880

Contents?: true

Size: 624 Bytes

Versions: 4

Compression:

Stored size: 624 Bytes

Contents

require 'raisin/testing/rspec/test_request'

module Raisin
  module FunctionalTest
    def self.append_features(base)
      base.class_eval do
        include RSpec::Rails::ControllerExampleGroup
        extend ClassMethods
      end

      super
    end

    module ClassMethods
      def controller_class
        metadata = self.metadata[:example_group]
        klass    = nil

        until metadata.nil? || klass.respond_to?(:new)
          klass    = metadata[:description_args].first
          metadata = metadata[:example_group]
        end

        klass.respond_to?(:new) ? klass : super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
raisin-0.0.5 lib/raisin/testing/rspec/functional_test.rb
raisin-0.0.4 lib/raisin/testing/rspec/functional_test.rb
raisin-0.0.2 lib/raisin/testing/rspec/functional_test.rb
raisin-0.0.1 lib/raisin/testing/rspec/functional_test.rb