Sha256: 18d6754b7fe9610598c211e976199c8c29c2abc788f4d888f73ed29a5ce58996

Contents?: true

Size: 1018 Bytes

Versions: 5

Compression:

Stored size: 1018 Bytes

Contents

require 'spec_helper'
require 'localeapp/missing_translations'

describe Localeapp::MissingTranslations, "#add(locale, key, options = {})" do
  it "stores the missing translation data" do
    translations = Localeapp::MissingTranslations.new
    translations.add(:en, 'foo', { :baz => 'bam' })
    translations[:en].should include('foo')
    translations[:en]['foo'].options.should == { :baz => 'bam' }
  end
end

describe Localeapp::MissingTranslations, "#to_send" do
  it "returns an array of missing translation data that needs to be sent to localeapp.com" do
    translations = Localeapp::MissingTranslations.new
    translations.add(:en, 'foo', { :baz => 'bam' })
    translations.add(:es, 'bar')

    to_send = translations.to_send
    to_send.size.should == 2
    to_send[0][:key].should == 'foo'
    to_send[0][:locale].should == :en
    to_send[0][:options].should == { :baz => 'bam' }
    to_send[1][:key].should == 'bar'
    to_send[1][:locale].should == :es
    to_send[1][:options].should == {}
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
localeapp-0.1.2 spec/localeapp/missing_translations_spec.rb
localeapp-0.1.1 spec/localeapp/missing_translations_spec.rb
localeapp-0.0.11 spec/localeapp/missing_translations_spec.rb
localeapp-0.0.10 spec/localeapp/missing_translations_spec.rb
localeapp-0.0.8 spec/localeapp/missing_translations_spec.rb