Sha256: 1b97521ff16b507f1aa8991599fad22c22551ae24dc873550c99e096ae7a45f3

Contents?: true

Size: 982 Bytes

Versions: 3

Compression:

Stored size: 982 Bytes

Contents

# frozen_string_literal: true

require 'active_support'
require 'action_view'
require 'page_title_helper'

unless defined?(IRB)
  require 'active_support/test_case'
  require 'shoulda'
end

# Use sorted tests. We need to change that after the tests have been converted
# to RSpec.
ActiveSupport.test_order = :sorted

# fake global Rails module
module Rails
  class << self
    def root
      @root ||= Pathname.new('/this/is/just/for/testing/page_title_helper')
    end

    def env
      'test'
    end
  end
end

# Mock ActionView a bit to allow easy (fake) template assignment
class TestView < ActionView::Base
  attr_reader :controller

  def initialize(controller_path = nil, action = nil)
    @controller = ActionView::TestCase::TestController.new
    @controller.controller_path = controller_path
    params[:action] = action if action
  end

  def controller!(controller_path, action)
    @controller.controller_path = controller_path
    params[:action] = action
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
page_title_helper-9.1.0 test/test_helper.rb
page_title_helper-9.0.0 test/test_helper.rb
page_title_helper-8.0.0 test/test_helper.rb