Skip to content

Commit

Permalink
OTWO-7202 Enlistment page must render without code location (#1772)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sig authored Mar 7, 2024
1 parent 008b368 commit e99ab09
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/null_models/nil_code_location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

class NilCodeLocation < NullObject
blank_methods :url, :nice_url
nil_methods :branch, :username, :password
nil_methods :branch, :username, :password, :cl_update_event_time, :best_code_set

def scm_type
:git
end

def scm_name_in_english
:Git
end

def do_not_fetch
true
end
Expand Down
4 changes: 4 additions & 0 deletions app/null_models/null_object.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# frozen_string_literal: true

class NullObject
def id
rand(20_000)
end

def nil?
true
end
Expand Down
8 changes: 8 additions & 0 deletions test/controllers/enlistments_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ class EnlistmentsControllerTest < ActionController::TestCase
_(response.body).must_match I18n.t('enlistments.index.failure.dnf_present')
end

it 'must render page when code_location is null' do
Enlistment.any_instance.stubs(:code_location).returns(NilCodeLocation.new)

mock_and_get :index, params: { project_id: @project_id }

assert_response :ok
end

it 'must render projects/deleted when project is deleted' do
login_as @account
ApplicationController.any_instance.stubs(:current_user_can_manage?).returns(true)
Expand Down

0 comments on commit e99ab09

Please sign in to comment.