Sha256: 2dd548e754820ef622cce32be7e8d2c0cbc0584ba3ec7b78243146fd27615e29
Contents?: true
Size: 1.07 KB
Versions: 43
Compression:
Stored size: 1.07 KB
Contents
require 'rspec/rails/view_assigns' module RSpec module Rails # @api public # Container module for helper specs. module HelperExampleGroup extend ActiveSupport::Concern include RSpec::Rails::RailsExampleGroup include ActionView::TestCase::Behavior include RSpec::Rails::ViewAssigns # @private module ClassMethods def determine_constant_from_test_name(_ignore) described_class if yield(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.example_group.described_class.to_s.sub(/Helper/, '').underscore end included do before do |example| controller.controller_path = _controller_path(example) end end end end end
Version data entries
43 entries across 40 versions & 7 rubygems