Sha256: 02136d4de792197952f93d38b91c5638ca74455827800153564ab5985febc2f6

Contents?: true

Size: 983 Bytes

Versions: 30

Compression:

Stored size: 983 Bytes

Contents

RSpec.describe Metasploit::Model::Spec::I18nExceptionHandler do
  subject(:i18n_exception_handler) do
    described_class.new
  end

  context '#call' do
    subject(:call) do
      i18n_exception_handler.call(exception, locale, key, options)
    end

    let(:exception) do
      I18n::MissingTranslation.new(locale, key, options)
    end

    let(:locale) do
      :en
    end

    let(:key) do
      :'missing.key'
    end

    let(:options) do
      {}
    end

    it 'should raise exception.to_exception' do
      converted_exception = exception.to_exception

      expect {
        call
      }.to raise_error(converted_exception.class) do |actual_exception|
        expect(actual_exception.class).to eq(converted_exception.class)
        expect(actual_exception.key).to eq(converted_exception.key)
        expect(actual_exception.locale).to eq(converted_exception.locale)
        expect(actual_exception.options).to eq(converted_exception.options)
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
metasploit-model-5.0.2 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-5.0.1 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-5.0.0 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-4.0.6 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-4.0.5 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-4.0.4 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-4.0.3 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-4.0.2 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-4.0.1 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-4.0.0 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-3.1.4 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-3.1.3 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-3.1.2 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-3.1.1 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-3.1.0 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-3.0.0 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-2.0.4 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-2.0.3 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-2.0.2 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb
metasploit-model-2.0.1 spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb