Sha256: 591d2afa6c8610c5827f596d122f7903eb795c2529ca354a21e1ce6ccc3675d3

Contents?: true

Size: 900 Bytes

Versions: 3

Compression:

Stored size: 900 Bytes

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_accessor :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 = {}
		puts '=', ctx.dispatcher.root
		klass, action, base = ctx.dispatcher.dispatch('/blog/list')
		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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nitro-0.10.0 test/nitro/tc_controller.rb
nitro-0.9.3 test/nitro/tc_controller.rb
nitro-0.9.5 test/nitro/tc_controller.rb