Sha256: f8069ace629de45980fd059253d27c47471997fdfd3538d1f8d921c657667194

Contents?: true

Size: 852 Bytes

Versions: 11

Compression:

Stored size: 852 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

11 entries across 11 versions & 2 rubygems

Version Path
translate-rails3-plus-0.0.15 spec/storage_spec.rb
translate-rails3-plus-0.0.14 spec/storage_spec.rb
translate-rails3-plus-0.0.13 spec/storage_spec.rb
translate-rails3-plus-0.0.12 spec/storage_spec.rb
translate-rails3-0.4.0 spec/storage_spec.rb
translate-rails3-0.2.3 spec/storage_spec.rb
translate-rails3-0.2.2 spec/storage_spec.rb
translate-rails3-0.2.0 spec/storage_spec.rb
translate-rails3-0.1.2 spec/storage_spec.rb
translate-rails3-0.1.1 spec/storage_spec.rb
translate-rails3-0.1.0 spec/storage_spec.rb