Last active
December 22, 2015 18:39
-
-
Save ronanrodrigo/6514830 to your computer and use it in GitHub Desktop.
Validate locale files with rspec!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment