Sha256: 8343d160bdc671c70fd5868eb2d4bae97a9c613511e31af2a23e45d781bcfe6a

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

describe Skala::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

              self.class.load_locales_from_directory(File.expand_path("#{File.dirname(__FILE__)}/../assets/locales"))
            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

1 entries across 1 versions & 1 rubygems

Version Path
skala-0.2.0 spec/skala/adapter_spec.rb