Sha256: 59d04188ceb7913e6dd52e91de2ccee5721159db4df352c6816606b8022c5255

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

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

describe Page do
  dataset :assets
  let(:page) { pages(:pictured) }

  # This isn't really a proper test of the deprecation mechanism, but perhaps it's right for the assets extensions
  
  context "Asset tags" do
    %w{top_padding width height caption asset_file_name asset_content_type asset_file_size id filename image flash thumbnail url link extension if_content_type page:title page:url}.each do |name|
      it "should have the new singular 'asset:#{name}' tag and method" do
        page.tags.include?("asset:#{name}").should be_true
        page.respond_to?("tag:asset:#{name}".to_sym).should be_true
      end
    
      it "should have the old plural 'assets:#{name}' tag and method" do
        page.tags.include?("assets:#{name}").should be_true
        page.respond_to?("tag:assets:#{name}".to_sym).should be_true
      end
    end
  end  
  
  context "substituting new tags for old" do
    it "should call the right substitute tag" do
      AssetTags.deprecated_tag 'mither', :substitute => 'assets:filename', :deadline => '3.0.0'
      Rails.logger.should_receive(:warn).at_least(:once)
      page.should render("<r:assets:first><r:mither /></r:assets:first>").as( 'asset.jpg' )
    end    
  end
  
  context "rendering a valid but deprecated tag" do
    it "should not err" do
      lambda{ 
        page.should render("<r:assets:first><r:assets:id /></r:assets:first>").as( asset_id(:tester).to_s )
      }.should_not raise_error
    end
    
    it "should log a warning"
    
    context "in development" do
      it "should render a visible warning"
    end
    
    context "in production" do
      it "should not render a visible warning"
    end
  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
radiant-1.0.0.rc1 vendor/extensions/assets/spec/lib/tag_deprecation_spec.rb