fix specs

This commit is contained in:
Chris
2025-08-02 21:12:16 -07:00
parent ed4e3c3ea4
commit f1bf0ceee9
4 changed files with 10 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ class Projects::BuildJob < ApplicationJob
def perform(build)
project = build.project
# If its a dockerhub deploy, we don't need to build the docker image
# If its a container registry deploy, we don't need to build the docker image
if project.container_registry?
build.info("Skipping build for #{project.name} because it's a deploying from a container registry")
else

View File

@@ -3,7 +3,7 @@
<h2 class="text-2xl font-bold">Create a new project from Git repository</h2>
<%= link_to(
"Deploy from Docker Hub instead →",
new_project_path(provider_type: Provider::DOCKER_TYPE),
new_project_path(provider_type: Provider::REGISTRY_TYPE),
class: "inline-block mt-2 underline underline-offset-4 text-blue-300 hover:text-blue-200 text-sm",
) %>
<hr class="mt-3 mb-4 border-t border-base-300" />

View File

@@ -4,8 +4,14 @@ RSpec.describe Providers::Create do
let(:subject) { described_class.call(provider) }
describe '.call' do
context 'when the provider is dockerhub' do
context 'when the provider is container registry' do
let(:provider) { build(:provider, :container_registry) }
before do
# Mock successful Docker authentication
allow(DockerCli).to receive(:with_registry_auth).and_yield
end
it 'creates the provider' do
subject
expect(subject).to be_success

View File

@@ -14,7 +14,7 @@ RSpec.describe Providers::GenerateConfigJson do
# First level base64 decode
result = Base64.strict_decode64(context.docker_config_json)
JSON.parse(result)
auth = JSON.parse(result)['auths']['https://index.docker.io/v1/']['auth']
auth = JSON.parse(result)['auths']['docker.io']['auth']
username, password = Base64.strict_decode64(auth).split(':')
expect(username).to eq(provider.username)
expect(password).to eq(provider.access_token)