Sha256: 89d638003cfe9dc8bec5ec62c232f2811aaaaa014ca00026698823adece80ad8

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 KB

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

require 'rspec'
require 'rspec/autorun' # somehow makes rcov work with rspec
require 'twitter_cldr'

if ENV['SCOV']
  require 'simplecov'
  SimpleCov.start
  puts 'Running simplecov'
end

class FastGettext
  class << self
    @@locale = :en

    def locale
      @@locale
    end

    def locale=(new_locale)
      @@locale = new_locale
    end
  end
end

class I18n
  class << self
    @@locale = :en

    def locale
      @@locale
    end

    def locale=(new_locale)
      @@locale = new_locale
    end
  end
end

RSpec.configure do |config|
  config.mock_with :rr

  config.filter_run(:focus => true)
  config.run_all_when_everything_filtered = true
  config.filter_run_excluding(:slow => true) unless ENV['FULL_SPEC']

  config.before(:each) do
    TwitterCldr.reset_locale_fallbacks
    TwitterCldr.locale = :en
    FastGettext.locale = :en
    I18n.locale = :en
  end
end

RSpec::Matchers.define :match_normalized do |expected|
  match do |actual|
    expected.localize.normalize(:using => :NFKC).to_s == actual.localize.normalize(:using => :NFKC).to_s
  end
end

def check_token_list(got, expected)
  got.size.should == expected.size
  expected.each_with_index do |exp_hash, index|
    exp_hash.each_pair do |exp_key, exp_val|
      got[index].send(exp_key).should == exp_val
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
twitter_cldr-2.4.3 spec/spec_helper.rb
twitter_cldr-3.0.0.beta1 spec/spec_helper.rb
twitter_cldr-2.4.2 spec/spec_helper.rb
twitter_cldr-2.4.1 spec/spec_helper.rb
twitter_cldr-2.4.0 spec/spec_helper.rb
twitter_cldr-2.2.0 spec/spec_helper.rb
twitter_cldr-2.1.1 spec/spec_helper.rb
twitter_cldr-2.1.0 spec/spec_helper.rb