mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 15:53:45 +08:00
b8cbe51026
This conversion is done by Transpec 3.1.0 with the following command: transpec * 424 conversions from: obj.should to: expect(obj).to * 325 conversions from: == expected to: eq(expected) * 38 conversions from: obj.should_not to: expect(obj).not_to * 15 conversions from: =~ /pattern/ to: match(/pattern/) * 9 conversions from: it { should ... } to: it { is_expected.to ... } * 5 conversions from: lambda { }.should_not to: expect { }.not_to * 4 conversions from: lambda { }.should to: expect { }.to * 2 conversions from: -> { }.should to: expect { }.to * 2 conversions from: -> { }.should_not to: expect { }.not_to * 1 conversion from: === expected to: be === expected * 1 conversion from: =~ [1, 2] to: match_array([1, 2]) For more details: https://github.com/yujinakayama/transpec#supported-conversions
60 lines
1.8 KiB
Ruby
60 lines
1.8 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe "i18n integrity checks" do
|
|
|
|
it 'should have an i18n key for all trust levels' do
|
|
TrustLevel.all.each do |ts|
|
|
expect(ts.name).not_to match(/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/
|
|
expect(s[:description]).not_to match(/translation missing/)
|
|
end
|
|
end
|
|
|
|
it "needs an i18n key (notification_types) for each Notification type" do
|
|
Notification.types.each_key do |type|
|
|
expect(I18n.t("notification_types.#{type}")).not_to match(/translation missing/)
|
|
end
|
|
end
|
|
|
|
it "has valid YAML for client" do
|
|
Dir["#{Rails.root}/config/locales/client.*.yml"].each do |f|
|
|
locale = /.*\.([^.]{2,})\.yml$/.match(f)[1]
|
|
client = YAML.load_file("#{Rails.root}/config/locales/client.#{locale}.yml")
|
|
expect(client.count).to eq(1)
|
|
expect(client[locale]).not_to eq(nil)
|
|
expect(client[locale].count).to eq(2)
|
|
expect(client[locale]["js"]).not_to eq(nil)
|
|
expect(client[locale]["admin_js"]).not_to eq(nil)
|
|
end
|
|
end
|
|
|
|
it "has valid YAML for server" do
|
|
Dir["#{Rails.root}/config/locales/server.*.yml"].each do |f|
|
|
locale = /.*\.([^.]{2,})\.yml$/.match(f)[1]
|
|
server = YAML.load_file("#{Rails.root}/config/locales/server.#{locale}.yml")
|
|
expect(server.count).to eq(1)
|
|
expect(server[locale]).not_to eq(nil)
|
|
end
|
|
end
|
|
|
|
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|
|
|
line.strip!
|
|
next if line.start_with? "#"
|
|
next if line.start_with? "---"
|
|
next if line.blank?
|
|
expect(line).to eq locale
|
|
break
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|