Sha256: 4cc976949314e762e784d4bf8ea66b0c2b8a0a44e810734a83e9112b8db4da7c
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') require 'test/unit' require 'ostruct' require 'nitro/context' require 'nitro/dispatcher' require 'nitro/controller' class TC_Controller < Test::Unit::TestCase # :nodoc: all include N class BlogController < Controller attr_reader :aflag, :tflag def initialize(context) super @template_root = 'test/public/blog' end def list @aflag = true end end def setup @disp = Dispatcher.new({ 'blog' => BlogController, }) @disp.template_root = File.join(File.dirname(__FILE__), '..', 'public') @conf = OpenStruct.new @conf.dispatcher = @disp end def test_render ctx = Context.new(@conf) ctx.headers = {} ctx.params = {} ctx.headers['REQUEST_URI'] = '/blog/list' klass, action = ctx.dispatcher.dispatch(ctx.path, ctx) c = klass.new(ctx) begin c.send(action) rescue RenderExit # drink end assert_equal true, c.aflag # the template is compiled assert_equal true, c.tflag end def test_action_methods # aflag/tflag are counted too! assert_equal 3, BlogController.action_methods.size assert BlogController.action_methods.include?('list') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.13.0 | test/nitro/tc_controller.rb |