Sha256: b7c3bcf4087592369c55619a1a1fc9814cab98fe7a86ad32bef409045ff8d479
Contents?: true
Size: 967 Bytes
Versions: 5
Compression:
Stored size: 967 Bytes
Contents
require 'spec_helper' module Liquid module Rails describe TranslateFilter do let(:context) { ::Liquid::Context.new } before do context.registers[:view] = ActionView::Base.new end it 'translate with default locale' do expect(::Liquid::Variable.new("'welcome' | translate").render(context)).to eq('Welcome everyone!') end it 'translate with specified locale' do expect(::Liquid::Variable.new("'welcome' | translate: locale: 'km'").render(context)).to eq('សូមស្វាគមន៍') end it 'translate with scope' do expect(::Liquid::Variable.new("'home' | translate: locale: 'km', scope: 'links'").render(context)).to eq('ទំព័រដើម') end it 'translate with interpolation' do expect(::Liquid::Variable.new("'welcome_name' | translate: locale: 'en', name: 'Jeremy'").render(context)).to eq('Welcome, Jeremy') end end end end
Version data entries
5 entries across 5 versions & 2 rubygems