Sha256: 129a0ae108a44ecb79a871ec7142ab1b8e63be30b08887dc4eb6a68f74d1fcf2
Contents?: true
Size: 1.68 KB
Versions: 1
Compression:
Stored size: 1.68 KB
Contents
require 'test_helper' class I18nAdminUtils::TranslationControllerTest < ActionController::TestCase tests I18nAdminUtils::TranslationController def destination File.expand_path('../../tmp/yml', __FILE__) end def filename File.join(destination, 'test_yml') end def setup I18n.backend = I18n::Backend::Simple.new I18n.load_path = Dir[Rails.root.join(destination, '*.{rb,yml}').to_s] I18n.backend.reload! I18nAdminUtils::Config.reset I18nAdminUtils::Config.yml_file = filename I18nAdminUtils::Config.search_folders =[File.expand_path('../../tmp/translation_use', __FILE__)] end test 'should get index' do get :index assert_response :success end test 'ajax should add translation with locale and key seperate' do locale = 'en' key = 'testkey.testsubkey' value = 'Super value!' xhr :get, :edit, :locale => locale, :key => key, :value => value assert JSON.parse(@response.body)['success'], "Response should be 'success' but is #{@response.body}" assert I18n.t(key, :locale => locale) == value, 'Translation should have been added' end test 'ajax should add translation with locale and key joined' do locale = 'en' key = 'testkey.localandkeytogether' value = 'Super value!' xhr :get, :edit, :key => "#{locale}.#{key}", :value => value assert JSON.parse(@response.body)['success'], "Response should be 'success' but is #{@response.body}" assert I18n.t(key, :locale => locale) == value, 'Translation should have been added' end test 'should get missing list' do I18n.backend.reload! get :missing_list assert_response :success end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
i18n_admin_utils-1.0.0 | test/controller/translation_controller_test.rb |