2013-02-05 14:16:51 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "i18n integrity checks" do
|
|
|
|
|
|
|
|
it 'should have an i18n key for all trust levels' do
|
|
|
|
TrustLevel.all.each do |ts|
|
|
|
|
ts.name.should_not =~ /translation missing/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "needs an i18n key (description) for each Site Setting" do
|
|
|
|
SiteSetting.all_settings.each do |s|
|
|
|
|
next if s[:setting] =~ /^test/
|
|
|
|
s[:description].should_not =~ /translation missing/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "needs an i18n key (notification_types) for each Notification type" do
|
2013-03-01 07:07:44 -05:00
|
|
|
Notification.types.keys.each do |type|
|
2013-02-25 11:42:20 -05:00
|
|
|
I18n.t("notification_types.#{type}").should_not =~ /translation missing/
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-03-20 05:51:28 -04:00
|
|
|
it "does not overwrite another language" do
|
|
|
|
Dir["#{Rails.root}/config/locales/*.yml"].each do |f|
|
|
|
|
locale = /.*\.([^.]{2,})\.yml$/.match(f)[1] + ':'
|
|
|
|
IO.foreach(f) do |line|
|
|
|
|
next if line.start_with? "#"
|
|
|
|
next if line.start_with? "---"
|
|
|
|
next if line.strip!.blank?
|
|
|
|
line.should eq locale
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
end
|