spec/lib/card/format_spec.rb in wagn-1.12.7 vs spec/lib/card/format_spec.rb in wagn-1.12.8

- old
+ new

@@ -1,10 +1,10 @@ # -*- encoding : utf-8 -*- require 'wagn/spec_helper' describe Card::Format do - +=begin describe :render do it "should ignore underscores in view names" do render_card(:not_found).should == render_card('not found') end @@ -166,8 +166,39 @@ assert_view_select result, 'fieldset' do assert_select 'input[name=?][type="text"][value="Zamma Flamma"]', 'card[cards][+author][content]' assert_select %{input[name=?][type="hidden"][value="#{Card::PhraseID}"]}, 'card[cards][+author][type_id]' end end + end + +=end + describe '#show?' do + before :all do + @format = described_class.new Card.new + end + + it "should respect defaults" do + @format.show_view?( :menu, {}, :show ).should be_true + @format.show_view?( :menu, {}, :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 }, :hide ).should be_true + @format.show_view?( :menu, { :optional_menu=>:hide }, :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' }, :hide ).should be_true + @format.show_view?( :menu, { :hide=>'menu, paging' }, :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