Sha256: b6b5fa4f46f2488029db7773a67632192c31f5d00aea0e15d5b7b21c07801e3e

Contents?: true

Size: 981 Bytes

Versions: 4

Compression:

Stored size: 981 Bytes

Contents

describe Celsius::Adapter do
  let(:adapter) { described_class.new() }

  context "when a class is derived from #{described_class}" do
    context "when the derived class overwrites .initialize" do
      context "when the derived class calls super inside the overwritten .initalize" do
        let(:derived_class) do
          Class.new(described_class) do
            def initialize
              super
            end
          end
        end

        let(:derived_class_instance) do
          derived_class.new
        end

        it "has access to the superclass locales" do
          translation_key_known_by_superclass = "field_names.creator"
          translation = derived_class_instance.translate(translation_key_known_by_superclass, locale: :de)
          expected_translation = derived_class_instance.class.class_variable_get(:@@locales)["de"]["field_names"]["creator"]
          expect(translation).to eq(expected_translation)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
celsius-0.4.3 spec/celsius/adapter_spec.rb
celsius-0.4.2 spec/celsius/adapter_spec.rb
celsius-0.4.1 spec/celsius/adapter_spec.rb
celsius-0.4.0 spec/celsius/adapter_spec.rb