forgot to add these

This commit is contained in:
Reinier Balt 2012-04-05 22:21:28 +02:00
parent 86afd42148
commit fde64e0b3d
145 changed files with 9044 additions and 0 deletions

View file

@ -0,0 +1,54 @@
require 'fileutils'
require File.dirname(__FILE__) + '/spec_helper'
describe Translate::File do
describe "write" do
before(:each) do
@file = Translate::File.new(file_path)
end
after(:each) do
FileUtils.rm(file_path)
end
it "writes all I18n messages for a locale to YAML file" do
@file.write(translations)
@file.read.should == Translate::File.deep_stringify_keys(translations)
end
def translations
{
:en => {
:article => {
:title => "One Article"
},
:category => "Category"
}
}
end
end
describe "deep_stringify_keys" do
it "should convert all keys in a hash to strings" do
Translate::File.deep_stringify_keys({
:en => {
:article => {
:title => "One Article"
},
:category => "Category"
}
}).should == {
"en" => {
"article" => {
"title" => "One Article"
},
"category" => "Category"
}
}
end
end
def file_path
File.join(File.dirname(__FILE__), "files", "en.yml")
end
end