Sha256: df7d1c473a4b1758b42a70a53718453506a76ed005e9b9372b4a22a58edf820e

Contents?: true

Size: 1.02 KB

Versions: 28

Compression:

Stored size: 1.02 KB

Contents

require "spec_helper"

describe AwesomeTranslations::TranslatedValue do
  let(:test_file_path) { "#{Dir.tmpdir}/da.yml" }

  let(:translated_value) do
    described_class.new(
      file: test_file_path,
      key: "activerecord.attributes.test_model.test",
      locale: :da,
      value: "test"
    )
  end

  before do
    test_translations = {
      "da" => {
        "activerecord" => {
          "attributes" => {
            "test_model" => {
              "test" => "test",
              "other_translation" => "En anden"
            }
          }
        }
      }
    }

    File.open(test_file_path, "w") do |fp|
      fp.write(YAML.dump(test_translations))
    end
  end

  it "#save!" do
    translated_value.value = "new test"
    translated_value.save!

    translations = YAML.load(File.read(test_file_path))

    expect(translations["da"]["activerecord"]["attributes"]["test_model"]["test"]).to eq "new test"
    expect(translations["da"]["activerecord"]["attributes"]["test_model"]["other_translation"]).to eq "En anden"
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
awesome_translations-0.0.53 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.52 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.51 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.50 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.49 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.48 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.47 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.46 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.45 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.44 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.43 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.42 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.41 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.40 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.39 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.38 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.37 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.36 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.35 spec/models/awesome_translations/translated_value_spec.rb
awesome_translations-0.0.34 spec/models/awesome_translations/translated_value_spec.rb