Sha256: 545380169602fc621543f8fdb6feef2394f83d326f90c939e7759624598ad1ab

Contents?: true

Size: 947 Bytes

Versions: 34

Compression:

Stored size: 947 Bytes

Contents

require 'rspec/rails/view_assigns'

module RSpec::Rails
  module HelperExampleGroup
    extend ActiveSupport::Concern
    include RSpec::Rails::RailsExampleGroup
    include ActionView::TestCase::Behavior
    include RSpec::Rails::ViewAssigns

    module ClassMethods
      # @api private
      def determine_default_helper_class(ignore)
        described_class
      end
    end

    # Returns an instance of ActionView::Base with the helper being specified
    # mixed in, along with any of the built-in rails helpers.
    def helper
      _view.tap do |v|
        v.extend(ApplicationHelper) if defined?(ApplicationHelper)
        v.assign(view_assigns)
      end
    end

    private

    def _controller_path
      example.example_group.described_class.to_s.sub(/Helper/,'').underscore
    end

    included do
      metadata[:type] = :helper

      before do
        controller.controller_path = _controller_path
      end
    end
  end
end

Version data entries

34 entries across 29 versions & 5 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-rails-2.13.0/lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.14.2 lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.14.1 lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.14.0 lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.14.0.rc1 lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.13.2 lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.13.1 lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.13.0 lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.12.2 lib/rspec/rails/example/helper_example_group.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.12.1 lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.12.0 lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.11.4 lib/rspec/rails/example/helper_example_group.rb
gem_repackager-0.1.0 support/gems/rspec-rails-2.11.0/lib/rspec/rails/example/helper_example_group.rb
rspec-rails-2.11.0 lib/rspec/rails/example/helper_example_group.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/example/helper_example_group.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/example/helper_example_group.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/example/helper_example_group.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/example/helper_example_group.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/lib/rspec/rails/example/helper_example_group.rb