svenfuchs/i18n — Issue #134: missing translation passes MissingTranslation instead MissingTranslationData
Author: pivotalhalogen
Created: 2012-01-11 03:04:48+00:00
State: open

Given this (a more specific version of the suggestion from rails guides http://guides.rubyonrails.org/i18n.html#using-different-exception-handlers ):

````ruby

module I18n
def self.just_raise_that_exception(exception, locale, key, options)
raise exception
end
end

I18n.exception_handler = :just_raise_that_exception
````

and this test:

````ruby
require 'spec_helper'

describe "MissingTranslationData" do
it "should raise an error for missing translation" do
expect {
I18n.t('totally.bogus.translation.key')
}.to raise_exception(I18n::MissingTranslationData)
end
end
````

You get the following failure:

````
expected I18n::MissingTranslationData, got #
````

Because `exception` is `I18n::MissingTranslation` not `I18n::MissingTranslationData` and `I18n::MissingTranslation` does not inherit from an Exception class.