Sha256: a077c94a786842bdc04b794dd61ad2c6905882e139c9db8d77ce57352c7328b7

Contents?: true

Size: 1.29 KB

Versions: 7

Compression:

Stored size: 1.29 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "../../spec_helper"))
describe WebResourceBundler::BlockData do
  describe "#apply_filter" do
    it "applies filter to block_data, its childs, and theirs childs etc." do
      filter = mock("filter")
      block_data = @sample_block_helper.sample_block_data
      filter.should_receive(:apply!).with(block_data)
      filter.should_receive(:apply!).with(block_data.child_blocks.first)
      filters = [filter]
      block_data.apply_filters(filters)
    end
  end

  describe "#all_childs" do
    it "creates array of block data and all its childs recursively" do
      block_data = @sample_block_helper.sample_block_data
      BlockData.all_childs(block_data).size.should == 2
    end
  end

  describe "#clone" do
    it "creates deep clone of block data" do
      block_data = @sample_block_helper.sample_block_data
      clon = block_data.clone
      block_data.object_id.should_not == clon.object_id
      ((block_data.files.map { |f| f.object_id })& clon.files.map {|f| f.object_id}).should be_empty
      child = block_data.child_blocks[0]
      child_copy = clon.child_blocks[0]
      child.object_id.should_not == child_copy.object_id 
      ((child.files.map { |f| f.object_id }) & child_copy.files.map {|f| f.object_id}).should be_empty
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
web_resource_bundler-0.0.20 spec/web_resource_bundler/content_management/block_data_spec.rb
web_resource_bundler-0.0.19 spec/web_resource_bundler/content_management/block_data_spec.rb
web_resource_bundler-0.0.18 spec/web_resource_bundler/content_management/block_data_spec.rb
web_resource_bundler-0.0.16 spec/web_resource_bundler/content_management/block_data_spec.rb
web_resource_bundler-0.0.15 spec/web_resource_bundler/content_management/block_data_spec.rb
web_resource_bundler-0.0.14 spec/web_resource_bundler/content_management/block_data_spec.rb
web_resource_bundler-0.0.13 spec/web_resource_bundler/content_management/block_data_spec.rb