Sha256: e67791ef05efc4ec9a585af24a2dcf78251194ccfb6b1ae0f1651440eaf881c5

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require "spec_helper"

describe AwesomeTranslations::CleanUpsController do
  let!(:original_file_path) { translation_value.file_path }
  let!(:translation_key) { create :translation_key, key: "some.key" }
  let!(:translation_value) do
    create :translation_value,
      translation_key: translation_key,
      locale: "da",
      file_path: Rails.root.join("config/locales/awesome_translations/some_file.yml")
  end
  let(:content) do
    {
      "da" => {
        "some" => {
          "key" => "something"
        }
      }
    }
  end

  before do
    FileUtils.mkdir_p(File.dirname(translation_value.file_path))
    File.write(translation_value.file_path, YAML.dump(content))
  end

  it "works" do
    visit new_clean_up_path
    expect(page).to have_http_status(:success)

    # Expect to find
    find(".translation-value[data-id='#{translation_value.id}']")
    find("input[type=submit]").click

    expect { translation_value.reload }.to raise_error(BazaModels::Errors::RecordNotFound)
    expect(File.exist?(original_file_path)).to eq false
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
awesome_translations-0.0.62 spec/features/clean_ups_spec.rb
awesome_translations-0.0.61 spec/features/clean_ups_spec.rb