Sha256: 9f851642908711166247dfe6b8cb01566376193056dbcaef4938635cda428502

Contents?: true

Size: 885 Bytes

Versions: 9

Compression:

Stored size: 885 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Translate::Storage do
  describe "write_to_file" do
    before(:each) do
      @storage = Translate::Storage.new(:en)
    end
  
    it "writes all I18n messages for a locale to YAML file" do
      I18n.backend.should_receive(:translations).and_return(translations)
      @storage.stub!(:file_path).and_return(file_path)
      file = mock(:file)
      file.should_receive(:write).with(translations)
      Translate::File.should_receive(:new).with(file_path).and_return(file)
      @storage.write_to_file
    end
  
    def file_path
      File.join(File.dirname(__FILE__), "files", "en.yml")
    end
    
    def translations
      {
        :en => {
          :article => {
            :title => "One Article"
          },
          :category => "Category"
        }
      }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
translate-rails3-plus-0.0.11 spec/storage_spec.rb
translate-rails3-plus-0.0.9 spec/storage_spec.rb
translate-rails3-plus-0.0.8 spec/storage_spec.rb
translate-rails3-plus-0.0.7 spec/storage_spec.rb
translate-rails3-plus-0.0.6 spec/storage_spec.rb
translate-rails3-plus-0.0.5 spec/storage_spec.rb
translate-rails3-plus-0.0.4 spec/storage_spec.rb
translate-rails3-plus-0.0.3 spec/storage_spec.rb
translate-rails3-plus-0.0.1 spec/storage_spec.rb