Sha256: 092285f4cd84b9c14fe624cf58dd77e5cb8631c0569efe8bc448f305d639c943

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

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=\"Spanish\" data-locale=\"ar\">&nbsp;</li><li class=\"flag gb\" data-cc=\"gb\" data-country_name=\"United Kingdom\" data-language_name=\"English\" data-locale=\"gb\">&nbsp;</li></ul>"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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