require "#{File.expand_path(File.dirname(__FILE__))}/helper" describe "AbstractController" do with_environment :test with_abstract_controller_spec before :all do @dir = "#{File.expand_path(File.dirname(__FILE__))}/controller_helper_spec" $LOAD_PATH << @dir AbstractController = Crystal::AbstractController end after :all do $LOAD_PATH.delete @dir remove_constants %w( SomeHelperSpec HelperSpec HelperMethodSpec AbstractController ) end it "helper_method" do class ::HelperMethodSpec inherit AbstractController def some_controller_method "some controller value (rendered in cotext of #{self.class})" end helper_method :some_controller_method def action; end end ccall(HelperMethodSpec, :action).content. should == "some controller value (rendered in cotext of HelperMethodSpec)" end it "helper" do module ::SomeHelperSpec def wiget "some wighet (rendered in context of #{self.class.name})" end end class ::HelperSpec inherit AbstractController helper SomeHelperSpec def action; end end ccall(HelperSpec, :action).content. should == "some wighet (rendered in context of HelperSpec::HelperSpecControllerContext)" end end