require 'spec_helper' describe WorldFlags::Helper::View do include ControllerTestHelpers, WorldFlags::Helper::View let(:default_size) { 24 } before do I18n.locale = 'ar' WorldFlags.config do |c| c.auto_select! c.available_locales = [:da, :sv, :nb, :en] c.reset! c.raise_error! end end it 'should translate flag code to locale' do WorldFlags.locale('dk').to_s.should == 'da' 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 raise error when unsupported flag size" 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