require 'spec_helper' describe WorldFlags::Helper::View do include ControllerTestHelpers, WorldFlags::Helper::View before do WorldFlags.auto_select! I18n.locale = 'ar' WorldFlags.available_locales = [:da, :sv, :nb, :en] WorldFlags.reset! WorldFlags.raise_error! end it "should be empty, with an empty block" do output = flags_list do end output.should == "" end it "should work with alias :flag_list" do output = flag_list do end output.should == "" end it "should set size to 16 or 32" do lambda do flags_list(8) { } end.should raise_error end it "should set size to 16 or 32" do output = flags_list 32 do end output.should == "" end it "should list flags using Array" do output = flags_list 32 do flags [:ar, :gb] end output.should == "" end it "should list flags using args" do output = flags_list 32 do flags :ar, :gb end output.should == "" end it "should list flags using args and :with_semi" do output = flags_list 32 do flags :ar, :gb, :with_semi => true end output.should == "" end it "should list flags" do output = flag_title :ar, 'Argentina' output.should == "
  •  
  • " end describe 'Countries' do context 'Danish locale' do before do I18n.locale = 'da' end it "should list nordic flags using args and :with_semi" do output = flags_list 32 do flags :dk, :se, :no, :with_semi => true, :country => :da end output.should == "" end end context 'Swedish locale' do before do I18n.locale = 'sv' end it "should list nordic flags using args and :with_semi" do output = flags_list 32 do flags :dk, :se, :no, :with_semi => true, :country => :da end output.should == "" end end context 'Norwegian locale' do before do I18n.locale = 'nb' end it "should list nordic flags using args and :with_semi" do output = flags_list 32 do flags :dk, :se, :no, :with_semi => true, :country => :da end output.should == "" end end end end