Sha256: 888064550a4b2b449527f3db448c2c4e696b44e3e1d52e8bf94aec3dbd13cd0d
Contents?: true
Size: 1.37 KB
Versions: 4
Compression:
Stored size: 1.37 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') $NITRO_NO_ENVIRONMENT = true require 'test/unit' require 'ostruct' require 'glue' require 'glue/logger' require 'nitro' class TC_Controller < Test::Unit::TestCase # :nodoc: all include Nitro class Blog2Controller < Controller attr_reader :aqflag, :tflag def self.template_root File.expand_path(Nitro::LibPath + '../../test/public/blog') end def list @aqflag = true end end def setup @disp = Dispatcher.new({ '/blog' => Blog2Controller, }) @conf = OpenStruct.new @conf.dispatcher = @disp end def test_render ctx = Context.new(@conf) ctx.headers = {} ctx.params = {} ctx.headers['REQUEST_URI'] = '/blog/list' ctx.instance_eval '@session = {}' klass, action = ctx.dispatcher.dispatch(ctx.path, ctx) c = klass.new(ctx) begin c.send(action) rescue RenderExit # drink end assert_equal true, c.aqflag assert_equal true, $include1 assert_equal true, $include2 # the template is compiled assert_equal true, c.tflag end def test_action_methods # aflag/tflag are counted too! # p Blog2Controller.action_methods # FIXME: the next 5 should be 3!! # assert_equal 5, Blog2Controller.action_methods.size assert Blog2Controller.action_methods.include?('list') end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.25.0 | test/nitro/tc_controller.rb |
nitro-0.26.0 | test/nitro/tc_controller.rb |
nitro-0.27.0 | test/nitro/tc_controller.rb |
nitro-0.28.0 | test/nitro/tc_controller.rb |