Sha256: a802b3d96c7992fe785c5b3a3fe785eacdf1238b0ccc1c1ee3729a976a7c40db

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crystal_ext-0.0.11 spec/controller/controller_helper_spec.rb