Sha256: ab9edeca5927f3aef1cb50c41a1179ac83912f8ec0c207698369dd3e45dab3a1

Contents?: true

Size: 1.22 KB

Versions: 18

Compression:

Stored size: 1.22 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 = 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

18 entries across 18 versions & 1 rubygems

Version Path
world-flags-0.6.5 spec/world_flags/json/json_languages_spec.rb
world-flags-0.6.4 spec/world_flags/json/json_languages_spec.rb
world-flags-0.6.3.1 spec/world_flags/json/json_languages_spec.rb
world-flags-0.6.3 spec/world_flags/json/json_languages_spec.rb
world-flags-0.6.2.1 spec/world_flags/json/json_languages_spec.rb
world-flags-0.6.2 spec/world_flags/json/json_languages_spec.rb
world-flags-0.6.1.1 spec/world_flags/json/json_languages_spec.rb
world-flags-0.6.1 spec/world_flags/json/json_languages_spec.rb
world-flags-0.6.0 spec/world_flags/json/json_languages_spec.rb
world-flags-0.5.1 spec/world_flags/json/json_languages_spec.rb
world-flags-0.5.0 spec/world_flags/json/json_languages_spec.rb
world-flags-0.4.9 spec/world_flags/json/json_languages_spec.rb
world-flags-0.4.8.3 spec/world_flags/json/json_languages_spec.rb
world-flags-0.4.8.2 spec/world_flags/json/json_languages_spec.rb
world-flags-0.4.7 spec/world_flags/json/json_languages_spec.rb
world-flags-0.4.5 spec/world_flags/json/json_languages_spec.rb
world-flags-0.4.4 spec/world_flags/json/json_languages_spec.rb
world-flags-0.4.3 spec/world_flags/json/json_languages_spec.rb