Sha256: 85f224b506151313958dc5b9bf4ca87c0357b1a07874e4cef4662fb61136522e

Contents?: true

Size: 1007 Bytes

Versions: 3

Compression:

Stored size: 1007 Bytes

Contents

module MiniTestSpecRails
  module Init
    module ActionViewBehavior

      def self.included(klass)
        klass.class_eval do
          class_attribute :_helper_class
          register_spec_type(/(Helper|View)( ?Test)?\z/i, self)
          register_spec_type(self) { |desc| Class === desc && desc < self }
          register_rails_test_case self
          before { setup_minitest_spec_rails_helper_class }
        end
      end

      private

      def helper_class=(new_class)
        self._helper_class = new_class
      end
      
      def helper_class
        if current_helper_class = self._helper_class
          current_helper_class
        else
          self.helper_class = determine_default_helper_class(name)
        end
      end

      def setup_minitest_spec_rails_helper_class
        self.class.helper_class = described_class
        self.class.send :include_helper_modules!
      end

    end
  end
end

ActionView::TestCase.send :include, MiniTestSpecRails::Init::ActionViewBehavior

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minitest-spec-rails-3.1.2 lib/minitest-spec-rails/init/action_view.rb
minitest-spec-rails-3.1.1 lib/minitest-spec-rails/init/action_view.rb
minitest-spec-rails-3.1.0 lib/minitest-spec-rails/init/action_view.rb