Skip to content

Commit

Permalink
Merge pull request #4352 from DFE-Digital/2005-bug-tda-a-levels-on-a-…
Browse files Browse the repository at this point in the history
…withdrawn-course

Don't show the A level change link when the course is withdrawn
  • Loading branch information
tomas-stefano authored Jul 9, 2024
2 parents ccdde36 + deddbac commit 34d6348
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/decorators/course_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def open_or_closed_for_applications
end

def a_level_change_path
return if object.is_withdrawn?

if object.a_level_subject_requirements.present?
h.publish_provider_recruitment_cycle_course_a_levels_add_a_level_to_a_list_path(
object.provider.provider_code,
Expand Down
14 changes: 14 additions & 0 deletions spec/decorators/course_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,20 @@
describe '#a_level_change_path' do
subject(:a_level_change_path) { course.decorate.a_level_change_path }

context 'when course is withdrawn' do
let(:course) do
build(
:course,
:with_a_level_requirements,
:withdrawn
)
end

it 'returns nil' do
expect(a_level_change_path).to be_nil
end
end

context 'when course does not have an A level subject requirement' do
let(:course) do
build(
Expand Down

0 comments on commit 34d6348

Please sign in to comment.