Sha256: f6564352b6a361e2d73f6712a34d3d155923ffc64dbf9f18db907662517dffb4

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe WorldFlags::Helper::View do
  include ControllerTestHelpers,
          WorldFlags::Helper::View

  def languages locale = :en
    path = File.join(SPEC_DIR, "../config/languages/locale_languages.#{locale}.json")
    JSON.parse(File.read(path))
  end

  before do
    WorldFlags.auto_select!
    I18n.locale = :en
    WorldFlags.available_locales = [:da, :sv, :nb, :en]
    WorldFlags.reset!
    WorldFlags.languages = Hashie::Mash.new languages
    WorldFlags.raise_error!
  end

  it "should list flags using Array" do
    output = flags_list 32 do
      flags [:ar, :gb]
    end
    output.should == "<ul class=\"f32\"><li class=\"flag ar\" data-cc=\"ar\" data-country_name=\"Argentina\" data-language_name=\"es-ar:Spanish\" data-locale=\"ar\">&nbsp;</li><li class=\"flag gb\" data-cc=\"gb\" data-country_name=\"United Kingdom\" data-language_name=\"en-gb:English\" data-locale=\"gb\">&nbsp;</li></ul>"
  end

  it "should list flags for Zaire with multiple language combis" do
    output = flags_list 32 do
      flags [:tw]
    end
    output.should == "<ul class=\"f32\"><li class=\"flag tw\" data-cc=\"tw\" data-country_name=\"Taiwan\" data-language_name=\"zh:Chinese,zh-tw:Taiwanese\" data-locale=\"tw\">&nbsp;</li></ul>"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
world-flags-0.4.2 spec/world_flags/json/json_languages_spec.rb