Sha256: fe5467c32aa37a61ddc2c116bdc1160b066b8949ba0a384d2ca96e8172693bdf

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe I18n::Screwdriver::Scanner do
  
  before do
    @scanner = I18n::Screwdriver::Scanner.new
  end

  describe "extract_translation" do
    it "returns an empty hash when no translation was found" do
      @scanner.send(:extract_translation, 'hello world').should == {}
    end
    
    it "returns a filled hash when translation was found" do
      @scanner.send(:extract_translation, '_("hello world")').should == {
        'hello world' => 'hello world'
      }
      
      @scanner.send(:extract_translation, '_("Going out today.")').should == {
        'Going out today' => 'Going out today.'
      }
      
      @scanner.send(:extract_translation, '_(".a.b.c.d.e")').should == {
        'abcde' => '.a.b.c.d.e'
      }
    end
  end
  
  describe "translation_to_key" do
    it "removes all dots" do
      @scanner.send(:translation_to_key, 'Good morning.').should == 'Good morning'
    end
  end
  
  describe "sorted_translations" do
    it "returns all translations sorted" do
      #@scanner.send(:sorted_translations) do |key, translation|
      #  puts "  \"#{key}\": \"#{translation}\""
      #end
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
i18n_screwdriver-0.6.0 spec/libraries/scanner_spec.rb
i18n_screwdriver-0.4.0 spec/libraries/scanner_spec.rb