Sha256: 7cf07af27733a917156e8a8fb6dd28427df3559472a15adf870358331c0fad0d
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 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 list @aflag = true end end def setup @disp = Dispatcher.new({ 'blog' => BlogController, }) @disp.root = File.join(File.dirname(__FILE__), '..', 'root') @conf = OpenStruct.new @conf.dispatcher = @disp end def test_render ctx = Context.new(@conf) ctx.headers = {} ctx.params = {} puts '=', ctx.dispatcher.root klass, action, base = ctx.dispatcher.dispatch('/blog/list', ctx) c = klass.new(ctx, base) 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.11.0 | test/nitro/tc_controller.rb |