Sha256: 49732e44ec29cfed82ce91e80582b5636e44c7a599556a98a2e7c78ab07a6916
Contents?: true
Size: 1.89 KB
Versions: 3
Compression:
Stored size: 1.89 KB
Contents
# encoding: utf-8 require 'spec_helper' describe RailsI18nterface::Sourcefiles do before :each do @root_dir = File.expand_path(File.join('..', '..', '..', 'spec', 'internal'), __FILE__) @cache_file = File.join(@root_dir, 'tmp', 'translation_strings') FileUtils.rm @cache_file if File.exists? @cache_file end it 'grabs field from schema.rb' do expected = { 'activerecord.models.article'=>['db/schema.rb'], 'activerecord.attributes.article.title'=>['db/schema.rb'], 'activerecord.attributes.article.body'=>['db/schema.rb'], 'activerecord.attributes.article.created_at'=>['db/schema.rb'], 'activerecord.attributes.article.updated_at'=>['db/schema.rb'], 'activerecord.attributes.article.active'=>['db/schema.rb'], 'activerecord.models.topic'=>['db/schema.rb'], 'activerecord.attributes.topic.title'=>['db/schema.rb'], 'activerecord.attributes.topic.created_at'=>['db/schema.rb'], 'activerecord.attributes.topic.updated_at'=>['db/schema.rb'] } hash = RailsI18nterface::Sourcefiles.extract_activerecords(@root_dir) hash.should == expected end it 'extracts translatable string from code source' do x = RailsI18nterface::Sourcefiles.load_files(@root_dir) File.exists?(@cache_file).should be_true x.size.should == 19 end describe 'refreshing' do before :each do RailsI18nterface::Sourcefiles.load_files(@root_dir) @testfile = File.join(@root_dir,'app','views','test.html.erb') end after :each do FileUtils.rm @testfile if File.exists? @testfile FileUtils.rm @cache_file if File.exists? @cache_file end it 'refreshes translatable strings cache' do File.open(File.join(@root_dir,'app','views','test.html.erb'),'w') do |f| f.puts "<%= t('something') %>" end y = RailsI18nterface::Sourcefiles.refresh(@root_dir) y.size.should == 20 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rails-i18nterface-0.2.3 | spec/lib/sourcefiles_spec.rb |
rails-i18nterface-0.2.2 | spec/lib/sourcefiles_spec.rb |
rails-i18nterface-0.2.1 | spec/lib/sourcefiles_spec.rb |