Sha256: 98e632b650eaa3e411ba4f288b681355ea5cc62c9e01cdcbe03d0439c5a8f644

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

USE_RAILS=true unless defined?(USE_RAILS)
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Lolita::I18n::Backend do

  it "should have fallback to default I18n store" do
    I18n.t("Page title").should == "Page title"
  end

  it "should set translation into DB" do
    ::I18n.t("test-key", :locale => :en, :default => '').should == ''
    Lolita::I18n::Backend.set("en.test-key","Hello")
    ::I18n.t("test-key", :locale => :en, :default => '').should == 'Hello'
  end

  it "should delete key from DB if empty value given" do
    Lolita::I18n::Backend.set("en.test-key","Hello")
    Lolita::I18n::Backend.get("en.test-key")[:value].should == "Hello"
    Lolita::I18n::Backend.set("en.test-key","")
    Lolita.i18n.store.get("en.test-key").should be_nil
  end

  it "should get translation into DB" do
    Lolita::I18n::Backend.get("en.test-key")[:value].should == ''
    Lolita::I18n::Backend.set("en.test-key","Hello")
    Lolita::I18n::Backend.get("en.test-key")[:value].should == "Hello"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lolita-i18n-0.3.0 spec/lolita-i18n/backend_spec.rb
lolita-i18n-0.1.18 spec/lolita-i18n/backend_spec.rb