Sha256: 84c22c5d789bfe10e218fde90abbef01c8e1eac9a4b2a9c4c2493f2e073053e6

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Ufo::Ecr::Auth do
  let(:repo_domain) { "https://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

15 entries across 15 versions & 1 rubygems

Version Path
ufo-2.3.0 spec/lib/ecr_auth_spec.rb
ufo-2.2.2 spec/lib/ecr_auth_spec.rb
ufo-2.2.1 spec/lib/ecr_auth_spec.rb
ufo-2.2.0 spec/lib/ecr_auth_spec.rb
ufo-2.1.0 spec/lib/ecr_auth_spec.rb
ufo-2.0.3 spec/lib/ecr_auth_spec.rb
ufo-2.0.2 spec/lib/ecr_auth_spec.rb
ufo-2.0.1 spec/lib/ecr_auth_spec.rb
ufo-2.0.0 spec/lib/ecr_auth_spec.rb
ufo-1.7.1 spec/lib/ecr_auth_spec.rb
ufo-1.7.0 spec/lib/ecr_auth_spec.rb
ufo-1.6.2 spec/lib/ecr_auth_spec.rb
ufo-1.6.1 spec/lib/ecr_auth_spec.rb
ufo-1.6.0 spec/lib/ecr_auth_spec.rb
ufo-1.5.0 spec/lib/ecr_auth_spec.rb