Sha256: 768abda586e708986a616647a8baf59ec1caa35d9bfeacdc0b6da154b1838271

Contents?: true

Size: 1.18 KB

Versions: 21

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'
require 'localeapp/missing_translations'

describe Localeapp::MissingTranslations, "#add(locale, key, description = nil, options = {})" do
  it "stores the missing translation data" do
    translations = Localeapp::MissingTranslations.new
    translations.add(:en, 'foo', 'bar', { :baz => 'bam' })
    translations[:en].should include('foo')
    translations[:en]['foo'].description.should == 'bar'
    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', nil, { :baz => 'bam' })
    translations.add(:es, 'bar', 'baz')

    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].should_not have_key(:description)
    to_send[0][:options].should == { :baz => 'bam' }
    to_send[1][:key].should == 'bar'
    to_send[1][:locale].should == :es
    to_send[1][:description].should == 'baz'
    to_send[1][:options].should == {}
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
localeapp-0.6.9 spec/localeapp/missing_translations_spec.rb
localeapp-0.6.8 spec/localeapp/missing_translations_spec.rb
localeapp-0.6.7 spec/localeapp/missing_translations_spec.rb
localeapp-0.6.6 spec/localeapp/missing_translations_spec.rb
localeapp-0.6.5 spec/localeapp/missing_translations_spec.rb
localeapp-0.6.4 spec/localeapp/missing_translations_spec.rb
localeapp-0.6.3 spec/localeapp/missing_translations_spec.rb
localeapp-0.6.2 spec/localeapp/missing_translations_spec.rb
localeapp-0.6.1 spec/localeapp/missing_translations_spec.rb
localeapp-0.6.0 spec/localeapp/missing_translations_spec.rb
localeapp-0.5.2 spec/localeapp/missing_translations_spec.rb
localeapp-0.5.1 spec/localeapp/missing_translations_spec.rb
localeapp-0.5.0 spec/localeapp/missing_translations_spec.rb
localeapp-0.4.3 spec/localeapp/missing_translations_spec.rb
localeapp-0.4.2 spec/localeapp/missing_translations_spec.rb
localeapp-0.4.1 spec/localeapp/missing_translations_spec.rb
localeapp-0.4.0 spec/localeapp/missing_translations_spec.rb
localeapp-0.3.2 spec/localeapp/missing_translations_spec.rb
localeapp-0.3.1 spec/localeapp/missing_translations_spec.rb
localeapp-0.3.0 spec/localeapp/missing_translations_spec.rb