mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 08:10:13 +01:00
forgot to add these
This commit is contained in:
parent
86afd42148
commit
fde64e0b3d
145 changed files with 9044 additions and 0 deletions
54
backup.rails2.3/plugins/translate/spec/file_spec.rb
Normal file
54
backup.rails2.3/plugins/translate/spec/file_spec.rb
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue