Valide os arquivos de localidade com rspec!

Teste o tamanho das linhas dos arquivos de localidade.

# Todo: Test presence of keys
require
'spec_helper'

describe
"Validade lines of locales files", js: true do
after
(:each) do
counter
= 1
base_file
= File.new(@locale_files.first)
while (line = base_file.gets)
counter
= counter + 1
end

@locale_files.each do |file|
compare_file
= File.new(file)
compare_counter
= 1
while (line = compare_file.gets)
compare_counter
= compare_counter + 1
end
file_name
= "==> " + File.dirname(compare_file).split("/").last + "/" + File.basename(compare_file)
expect
(compare_counter).to eq(counter), file_name
end
end

it
"should be locales/views lines are the same" do
@locale_files = Dir[Rails.root.join('config', 'locales', 'views', '*.{rb,yml}')]
end

it
"should be locales/form lines are the same" do
@locale_files = Dir[Rails.root.join('config', 'locales', 'form', '*.{rb,yml}')]
end

it
"should be locales/devise lines are the same" do
@locale_files = Dir[Rails.root.join('config', 'locales', 'devise', '*.{rb,yml}')]
end
end