Sha256: 69d767b785e460bb2c04997b5bdf92bd937ea46801fd111fe42a3465907e4b15

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

# Configure Rails Environment
ENV["RAILS_ENV"] = "test"

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require "rails/test_help"

Rails.backtrace_cleaner.remove_silencers!

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

# Load fixtures from the engine
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
  ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
end

class ActiveSupport::TestCase
  fixtures :all
end

class ActionController::TestCase
  
  #Overrides get, post etc. to use a default :use_route of :disclaimer
  def process(action, parameters, session = nil, flash = nil, http_method = 'GET')
    parameters ||= Hash.new
    parameters[:use_route] = :disclaimer unless parameters[:use_route]
    super
  end
  
  def actions_and_controllers
    Disclaimer::Engine.routes.routes.collect{|r| r.defaults}
  end

  def actions_for_controller(controller = 'disclaimer/documents')
    actions_and_controllers.select{|p| p[:controller] == controller}.collect{|ac| ac[:action]}
  end
  
end


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
disclaimer-0.1.1 test/test_helper.rb
disclaimer-0.1.0 test/test_helper.rb
disclaimer-0.0.7 test/test_helper.rb
disclaimer-0.0.6 test/test_helper.rb
disclaimer-0.0.5 test/test_helper.rb
disclaimer-0.0.4 test/test_helper.rb
disclaimer-0.0.3 test/test_helper.rb
disclaimer-0.0.2 test/test_helper.rb