Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cwninja-assert_i18n

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cwninja-assert_i18n

  • 0.4
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

h1. AssertI18n

A collection of @I18n@ assertions I use in daily life.

h2. Assertions Provided:

  • @assert_no_missing_translations@ - Checks that no missing translation errors occurred inside the block
  • @assert_all_locales_have_all_translations_available_to_the_default_locale@ - Makes sure all your locale translations files are in sync with your default locale.
  • @assert_localized_file_availability@ - Checks that a file is exists in all @available_locales@.

h2. Helpers Provided:

  • @each_locale@ - Iterates over each locale, passing in the locale as a parameter to the block.
  • @with_each_locale@ - Iterates over each locale, setting I18n.locale and running the block for each locale in turn.

h2. Usage:

h3. assert_no_missing_translations:

  class FooTest < Test::Unit::TestCase
    include AssertI18n::TestHelper
    
    def test_should_have_translations_for_the_word_foo
      assert_no_missing_translations do
        I18n.t(:foo)
      end
    end

    def test_should_have_all_translations_needed_for_rendering_email
      assert_no_missing_translations do
        MyApp::EMailRenderer.new(:foo).render!
      end
    end
  end

h3. assert_all_locales_have_all_translations_available_to_the_default_locale

  class PredeployTest < Test::Unit::TestCase
    include AssertI18n::TestHelper
    def test_all_locales_have_all_translations_available_to_the_default_locale
      assert_all_locales_have_all_translations_available_to_the_default_locale
    end
  end

h3. assert_localized_file_availability

  class PredeployTest < Test::Unit::TestCase
    include AssertI18n::TestHelper
    def test_we_have_our_logo_in_all_locales
      assert_localized_file_availability("#{Rails.root}/public/images/logo_%s.png")
    end
  end

h3. each_locale

  class PredeployTest < Test::Unit::TestCase
    include AssertI18n::TestHelper
    def test_should_foo_for_all_locales
      each_locale do |locale|
        assert_some_foo_is_ok_in(locale)
      end
    end
  end

h3. with_each_locale

  class PredeployTest < Test::Unit::TestCase
    include AssertI18n::TestHelper
    def test_should_foo_for_all_locales
      with_each_locale do
        assert_that_something_still_works
      end
    end
  end

FAQs

Package last updated on 11 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc