Sha256: 8f2acc524a9f99bb5c9f0394ae32e67c47e007c31ff5cecf6207f7fa83807264

Contents?: true

Size: 907 Bytes

Versions: 30

Compression:

Stored size: 907 Bytes

Contents

require File.dirname(__FILE__) + "/../../../spec_helper"

class TemplateStub
  attr_accessor :block
  def capture(&block)
    @block = block
  end
end

describe Radiant::AdminUI::RegionPartials do
  before :each do
    @template = TemplateStub.new
    @rp = Radiant::AdminUI::RegionPartials.new(@template)
  end
  
  it "should return a string when the specified partial does not exist" do
    @rp['foo'].should == "<strong>`foo' default partial not found!</strong>"
  end
  
  it "should expose partials via bracket accessor" do
    block = lambda { "Hello World!" }
    @rp.main(&block)
    @rp['main'].should === block
  end
  
  it "should capture a block when passed" do
    @rp.edit_extended_metadata do
      "Hello, World!"
    end
    
    @template.block.should be_kind_of(Proc)
    @template.block.should === @rp.edit_extended_metadata
    @template.block.call.should == "Hello, World!"
  end
end

Version data entries

30 entries across 30 versions & 4 rubygems

Version Path
radiant-1.0.0.rc3 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiant-1.0.0.rc2 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiant-1.0.0.rc1 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiant-rails3-0.1 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.2.4 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.2.2 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.2.1 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.2 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1.9 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1.8 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1.7 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1.6 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1.5 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1.4 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1.3 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1.2 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1.1 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiantcms-couchrest_model-0.1 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiant-0.7.2 spec/lib/radiant/admin_ui/region_partials_spec.rb
radiant-0.9.1 spec/lib/radiant/admin_ui/region_partials_spec.rb