annotate .svn/pristine/33/3396ee85e7860d58bce2840b1f00fae7a535409f.svn-base @ 1327:287f201c2802 redmine-2.2-integration

Add italic
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 19 Jun 2013 20:56:22 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 module TestHelper
Chris@909 2 def self.report_location(path)
Chris@909 3 [RAILS_ROOT + '/', 'vendor/plugins/'].each { |part| path.sub! part, ''}
Chris@909 4 path = path.split('/')
Chris@909 5 location, subject = path.first, path.last
Chris@909 6 if subject.sub! '.rb', ''
Chris@909 7 subject = subject.classify
Chris@909 8 else
Chris@909 9 subject.sub! '.html.erb', ''
Chris@909 10 end
Chris@909 11 "#{subject} (from #{location})"
Chris@909 12 end
Chris@909 13
Chris@909 14 def self.view_path_for path
Chris@909 15 [RAILS_ROOT + '/', 'vendor/plugins/', '.html.erb'].each { |part| path.sub! part, ''}
Chris@909 16 parts = path.split('/')
Chris@909 17 parts[(parts.index('views')+1)..-1].join('/')
Chris@909 18 end
Chris@909 19 end
Chris@909 20
Chris@909 21 class Test::Unit::TestCase
Chris@909 22 # Add more helper methods to be used by all tests here...
Chris@909 23 def get_action_on_controller(*args)
Chris@909 24 action = args.shift
Chris@909 25 with_controller *args
Chris@909 26 get action
Chris@909 27 end
Chris@909 28
Chris@909 29 def with_controller(controller, namespace = nil)
Chris@909 30 classname = controller.to_s.classify + 'Controller'
Chris@909 31 classname = namespace.to_s.classify + '::' + classname unless namespace.nil?
Chris@909 32 @controller = classname.constantize.new
Chris@909 33 end
Chris@909 34
Chris@909 35 def assert_response_body(expected)
Chris@909 36 assert_equal expected, @response.body
Chris@909 37 end
Chris@909 38 end
Chris@909 39
Chris@909 40 # Because we're testing this behaviour, we actually want these features on!
Chris@909 41 Engines.disable_application_view_loading = false
Chris@909 42 Engines.disable_application_code_loading = false