Sha256: a3f7e26f683922be466f95f107cea015ff4d2f2897f0d5e8be3ccda4a4527130

Contents?: true

Size: 1.05 KB

Versions: 63

Compression:

Stored size: 1.05 KB

Contents

describe Ufo::Ecr::Auth do
  let(:repo_domain) { "123456789.dkr.ecr.us-east-1.amazonaws.com" }
  let(:auth) { Ufo::Ecr::Auth.new(repo_domain) }
  before(:each) do
    allow(auth).to receive(:fetch_auth_token).and_return("opensesame")
  end

  context("update") do
    before(:each) do
      clean_home
    end

    context("missing ~/.docker/config.json") do
      it "should create the auth token" do
        auth.update
        data = JSON.load(IO.read("spec/fixtures/home/.docker/config.json"))
        auth_token = data["auths"][repo_domain]["auth"]
        expect(auth_token).to eq("opensesame")
      end
    end

    context("existing ~/.docker/config.json") do
      it "should update the auth token" do
        auth.update
        data = JSON.load(IO.read("spec/fixtures/home/.docker/config.json"))
        auth_token = data["auths"][repo_domain]["auth"]
        expect(auth_token).to eq("opensesame")
      end
    end
  end

  def clean_home
    FileUtils.rm_rf("spec/fixtures/home")
    FileUtils.cp_r("spec/fixtures/home_existing", "spec/fixtures/home")
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
ufo-5.0.1 spec/lib/ecr_auth_spec.rb
ufo-5.0.0 spec/lib/ecr_auth_spec.rb
ufo-4.6.3 spec/lib/ecr_auth_spec.rb
ufo-4.6.2 spec/lib/ecr_auth_spec.rb
ufo-4.6.1 spec/lib/ecr_auth_spec.rb
ufo-4.6.0 spec/lib/ecr_auth_spec.rb
ufo-4.5.11 spec/lib/ecr_auth_spec.rb
ufo-4.5.10 spec/lib/ecr_auth_spec.rb
ufo-4.5.9 spec/lib/ecr_auth_spec.rb
ufo-4.5.8 spec/lib/ecr_auth_spec.rb
ufo-4.5.7 spec/lib/ecr_auth_spec.rb
ufo-4.5.6 spec/lib/ecr_auth_spec.rb
ufo-4.5.5 spec/lib/ecr_auth_spec.rb
ufo-4.5.4 spec/lib/ecr_auth_spec.rb
ufo-4.5.3 spec/lib/ecr_auth_spec.rb
ufo-4.5.2 spec/lib/ecr_auth_spec.rb
ufo-4.5.1 spec/lib/ecr_auth_spec.rb
ufo-4.5.0 spec/lib/ecr_auth_spec.rb
ufo-4.4.3 spec/lib/ecr_auth_spec.rb
ufo-4.4.2 spec/lib/ecr_auth_spec.rb