Sha256: 845fa1f4d1dd0d33136a95c26a99160b2e18cc5c2ae5f658155a60dca7721d58

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

# -*- encoding : utf-8 -*-

describe Card::Format do

  describe '#show?' do
    before :all do
      @format = described_class.new Card.new
    end
    
    it "should respect defaults" do
      @format.show_view?( :menu, :default_visibility=>:show ).should be_true
      @format.show_view?( :menu, :default_visibility=>:hide ).should be_false
      @format.show_view?( :menu, {}                          ).should be_true
    end
    
    it "should respect developer default overrides" do
      @format.show_view?( :menu, :optional_menu=>:show, :default_visibility=>:hide ).should be_true
      @format.show_view?( :menu, :optional_menu=>:hide, :default_visibility=>:show ).should be_false
      @format.show_view?( :menu, :optional_menu=>:hide                             ).should be_false
    end
    
    it "should handle args from inclusions" do
      @format.show_view?( :menu, :show=>'menu', :default_visibility=>:hide         ).should be_true
      @format.show_view?( :menu, :hide=>'menu, paging', :default_visibility=>:show ).should be_false
      @format.show_view?( :menu, :show=>'menu', :optional_menu=>:hide              ).should be_true      
    end
    
    it "should handle hard developer overrides" do
      @format.show_view?( :menu, :optional_menu=>:always, :hide=>'menu' ).should be_true
      @format.show_view?( :menu, :optional_menu=>:never,  :show=>'menu' ).should be_false
    end
    
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wagn-1.13.0 spec/lib/card/format_spec.rb
wagn-1.13.0.pre2 spec/lib/card/format_spec.rb