Sha256: c92aee61874f42531b82c8407b82a5134e53beff4958a48b67b4f7eb03fabea0

Contents?: true

Size: 877 Bytes

Versions: 4

Compression:

Stored size: 877 Bytes

Contents

require 'spec_helper'

include Persons

def __find__( clazz, what, name )
  g = clazz.new name => 'bla'
  f = g.send(what).detect{|w|w.name == name}
  f.name.should == name
  f
end

def check_local( en, de )
  I18n.locale = :en
  yield.should == en
  I18n.locale = :de
  yield.should == de
end

describe 'I18n' do
  it 'should translate filter labels' do
    check_local('en_name', 'de_name'){ __find__(PersonGrid, :filters, :localname).label }
  end

  it 'should translate facet labels' do
    check_local('en_label', 'de_label'){ __find__(PersonGrid, :facets, :localname).label }
  end

  class HeaderGrid < Gitter::Grid
    grid do 
      scope do Person.scoped end
      column :localname, :column => :name
    end
  end
  
  it 'should translate column headers' do
    check_local('en_header', 'de_header'){ __find__(HeaderGrid, :columns, :localname).header }
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gitter-1.1.6 spec/i18n_spec.rb
gitter-1.1.5 spec/i18n_spec.rb
gitter-1.1.4 spec/i18n_spec.rb
gitter-1.1.3 spec/i18n_spec.rb