Skip to content

Instantly share code, notes, and snippets.

@flov
Created February 4, 2016 15:43
Show Gist options
  • Save flov/46bb4dfd51407670c60e to your computer and use it in GitHub Desktop.
Save flov/46bb4dfd51407670c60e to your computer and use it in GitHub Desktop.

Revisions

  1. flov created this gist Feb 4, 2016.
    34 changes: 34 additions & 0 deletions missing_translation_spec.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    require 'i18n/tasks'
    require 'ruby_cowsay'
    require 'lolcat'

    RSpec.describe 'I18n' do
    let(:i18n) { I18n::Tasks::BaseTask.new }
    let(:missing_keys) { i18n.missing_keys }
    let(:cows) { [
    "beavis.zen", "bong", "bud-frogs", "bunny", "cheese", "cower",
    "daemon", "default", "dragon-and-cow", "dragon", "elephant-in-snake",
    "elephant", "eyes", "flaming-sheep", "ghostbusters", "head-in",
    "hellokitty", "kiss", "kitty", "koala", "kosh", "luke-koala",
    "mech-and-cow", "meow", "milk", "moofasa", "moose", "mutilated", "ren",
    "satanic", "sheep", "skeleton", "small", "sodomized", "stegosaurus",
    "stimpy", "supermilker", "surgery", "telebears", "three-eyes",
    "turkey", "turtle", "tux", "udder", "vader-koala", "vader", "www"
    ] }

    it 'tests for missing locales' do
    expect(missing_keys).to be_empty
    end

    it 'cowsays the missing locales' do
    if missing_keys.leaves.count > 0
    puts ""
    puts(
    Lol.halp!(
    Cow.new({ cow: cows.sample }).say("Locales missing: #{missing_keys.leaves.count}")
    )
    )
    puts ""
    end
    end
    end