diff --git a/app/components/candidate_interface/application_dashboard_course_choices_component.rb b/app/components/candidate_interface/application_dashboard_course_choices_component.rb
index 9363734f04c..59a50d09173 100644
--- a/app/components/candidate_interface/application_dashboard_course_choices_component.rb
+++ b/app/components/candidate_interface/application_dashboard_course_choices_component.rb
@@ -149,7 +149,12 @@ def status_row(application_choice)
if @show_status
{
key: 'Status',
- value: render(ApplicationStatusTagComponent.new(application_choice:)),
+ value: render(
+ ApplicationStatusTagComponent.new(
+ application_choice:,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ ),
+ ),
}
end
end
diff --git a/app/components/candidate_interface/application_status_tag_component.html.erb b/app/components/candidate_interface/application_status_tag_component.html.erb
index 2e41a6804bd..56812839b3b 100644
--- a/app/components/candidate_interface/application_status_tag_component.html.erb
+++ b/app/components/candidate_interface/application_status_tag_component.html.erb
@@ -1,4 +1,7 @@
<%= govuk_tag(text: text, colour: colour) %>
+<% supplementary_tags do |supplementary_tag_text, supplementary_tag_colour| %>
+ <%= govuk_tag(text: supplementary_tag_text, colour: supplementary_tag_colour) %>
+<% end %>
<% if @display_info_text %>
<% if @application_choice.application_not_sent? %>
diff --git a/app/components/candidate_interface/application_status_tag_component.rb b/app/components/candidate_interface/application_status_tag_component.rb
index c04880ca3e3..476308c861d 100644
--- a/app/components/candidate_interface/application_status_tag_component.rb
+++ b/app/components/candidate_interface/application_status_tag_component.rb
@@ -2,9 +2,10 @@ module CandidateInterface
class ApplicationStatusTagComponent < ViewComponent::Base
delegate :status, to: :application_choice
- def initialize(application_choice:, display_info_text: true)
+ def initialize(application_choice:, display_info_text: true, supplementary_statuses: [])
@application_choice = application_choice
@display_info_text = display_info_text
+ @supplementary_statuses = supplementary_statuses
end
def text
@@ -36,8 +37,27 @@ def colour
end
end
+ def supplementary_tags
+ @supplementary_statuses.each do |supplementary_status|
+ yield supplementary_tag_text(supplementary_status), supplementary_tag_colour(supplementary_status)
+ end
+ end
+
private
+ def supplementary_tag_text(supplementary_status)
+ I18n.t!("supplementary_application_states.#{supplementary_status}.name")
+ end
+
+ def supplementary_tag_colour(supplementary_status)
+ case supplementary_status.to_s
+ when 'ske_pending_conditions'
+ 'blue'
+ else
+ raise "You need to define a colour for the #{supplementary_status} supplementary state"
+ end
+ end
+
attr_reader :application_choice
end
end
diff --git a/app/components/candidate_interface/continuous_applications/application_review_component.rb b/app/components/candidate_interface/continuous_applications/application_review_component.rb
index e812ee77ec2..950294c9777 100644
--- a/app/components/candidate_interface/continuous_applications/application_review_component.rb
+++ b/app/components/candidate_interface/continuous_applications/application_review_component.rb
@@ -27,7 +27,13 @@ def status_row
{
key: 'Status',
- value: render(ApplicationStatusTagComponent.new(application_choice:, display_info_text: false)),
+ value: render(
+ ApplicationStatusTagComponent.new(
+ application_choice:,
+ display_info_text: false,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ ),
+ ),
}
end
diff --git a/app/components/candidate_interface/continuous_applications/application_summary_component.rb b/app/components/candidate_interface/continuous_applications/application_summary_component.rb
index 01b71a7d36a..a13969fc681 100644
--- a/app/components/candidate_interface/continuous_applications/application_summary_component.rb
+++ b/app/components/candidate_interface/continuous_applications/application_summary_component.rb
@@ -70,7 +70,12 @@ def course_details
def application_choice_status_row
{
key: 'Status',
- value: render(ContinuousApplications::ApplicationStatusTagComponent.new(application_choice:)),
+ value: render(
+ ContinuousApplications::ApplicationStatusTagComponent.new(
+ application_choice:,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ ),
+ ),
}
end
end
diff --git a/app/components/candidate_interface/course_choices_review_component.rb b/app/components/candidate_interface/course_choices_review_component.rb
index 7de57c5c913..63ab2c69cb3 100644
--- a/app/components/candidate_interface/course_choices_review_component.rb
+++ b/app/components/candidate_interface/course_choices_review_component.rb
@@ -270,7 +270,12 @@ def status_row(application_choice)
if @show_status
{
key: 'Status',
- value: render(ApplicationStatusTagComponent.new(application_choice:)),
+ value: render(
+ ApplicationStatusTagComponent.new(
+ application_choice:,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ ),
+ ),
}
end
end
diff --git a/app/components/candidate_interface/previous_applications_component.html.erb b/app/components/candidate_interface/previous_applications_component.html.erb
index 1e543c31d78..adc4d383661 100644
--- a/app/components/candidate_interface/previous_applications_component.html.erb
+++ b/app/components/candidate_interface/previous_applications_component.html.erb
@@ -22,7 +22,12 @@
<% end %>
- <%= render CandidateInterface::ApplicationStatusTagComponent.new(application_choice: application_choice) %>
+ <%=
+ render CandidateInterface::ApplicationStatusTagComponent.new(
+ application_choice: application_choice,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ )
+ %>
|
<% end %>
diff --git a/app/components/candidate_interface/rejection_reasons_component.rb b/app/components/candidate_interface/rejection_reasons_component.rb
index 51220bb4b20..6285fad73a7 100644
--- a/app/components/candidate_interface/rejection_reasons_component.rb
+++ b/app/components/candidate_interface/rejection_reasons_component.rb
@@ -40,7 +40,12 @@ def course_details_row_value(application_choice)
def status_row(application_choice)
{
key: 'Status',
- value: render(ApplicationStatusTagComponent.new(application_choice:)),
+ value: render(
+ ApplicationStatusTagComponent.new(
+ application_choice:,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ ),
+ ),
}
end
diff --git a/app/components/provider_interface/application_card_component.html.erb b/app/components/provider_interface/application_card_component.html.erb
index 7e7018b8e6d..053ad4d0a6b 100644
--- a/app/components/provider_interface/application_card_component.html.erb
+++ b/app/components/provider_interface/application_card_component.html.erb
@@ -6,7 +6,14 @@
<%= application_choice.id %>
- <%= render ProviderInterface::ApplicationStatusTagComponent.new(application_choice: application_choice) %>
+
+ <%= render(
+ ProviderInterface::ApplicationStatusTagComponent.new(
+ application_choice: application_choice,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ ),
+ ) %>
+
diff --git a/app/components/provider_interface/application_choice_header_component.html.erb b/app/components/provider_interface/application_choice_header_component.html.erb
index a279053fca6..0d0fdc29579 100644
--- a/app/components/provider_interface/application_choice_header_component.html.erb
+++ b/app/components/provider_interface/application_choice_header_component.html.erb
@@ -1,6 +1,13 @@
<%= application_choice.application_form.full_name %>
- <%= render(ProviderInterface::ApplicationStatusTagComponent.new(application_choice: application_choice)) %>
+
+ <%= render(
+ ProviderInterface::ApplicationStatusTagComponent.new(
+ application_choice: application_choice,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ ),
+ ) %>
+
<% if show_inset_text? -%>
diff --git a/app/components/provider_interface/application_status_tag_component.html.erb b/app/components/provider_interface/application_status_tag_component.html.erb
index a32d93128a1..9d581972d8c 100644
--- a/app/components/provider_interface/application_status_tag_component.html.erb
+++ b/app/components/provider_interface/application_status_tag_component.html.erb
@@ -1 +1,4 @@
<%= govuk_tag(text: text, colour: colour) %>
+<% supplementary_tags do |supplementary_tag_text, supplementary_tag_colour| %>
+ <%= govuk_tag(text: supplementary_tag_text, colour: supplementary_tag_colour) %>
+<% end %>
diff --git a/app/components/provider_interface/application_status_tag_component.rb b/app/components/provider_interface/application_status_tag_component.rb
index c29429d9f6b..101131f70b0 100644
--- a/app/components/provider_interface/application_status_tag_component.rb
+++ b/app/components/provider_interface/application_status_tag_component.rb
@@ -2,8 +2,9 @@ module ProviderInterface
class ApplicationStatusTagComponent < ViewComponent::Base
delegate :status, to: :application_choice
- def initialize(application_choice:)
+ def initialize(application_choice:, supplementary_statuses: [])
@application_choice = application_choice
+ @supplementary_statuses = supplementary_statuses
end
def text
@@ -33,8 +34,27 @@ def colour
end
end
+ def supplementary_tags
+ @supplementary_statuses.each do |supplementary_status|
+ yield supplementary_tag_text(supplementary_status), supplementary_tag_colour(supplementary_status)
+ end
+ end
+
private
+ def supplementary_tag_text(supplementary_status)
+ I18n.t!("supplementary_application_states.#{supplementary_status}.name")
+ end
+
+ def supplementary_tag_colour(supplementary_status)
+ case supplementary_status.to_s
+ when 'ske_pending_conditions'
+ 'blue'
+ else
+ raise "You need to define a colour for the #{supplementary_status} supplementary state"
+ end
+ end
+
attr_reader :application_choice
end
end
diff --git a/app/components/support_interface/application_card_component.html.erb b/app/components/support_interface/application_card_component.html.erb
index 2302cc86685..bc5e2249834 100644
--- a/app/components/support_interface/application_card_component.html.erb
+++ b/app/components/support_interface/application_card_component.html.erb
@@ -11,7 +11,14 @@
<% application_choices.each do |application_choice| %>
-
- <%= render SupportInterface::ApplicationStatusTagComponent.new(status: application_choice.status) %>
+ <%=
+ render(
+ SupportInterface::ApplicationStatusTagComponent.new(
+ status: application_choice.status,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ ),
+ )
+ %>
<%= application_choice.current_course_option.course.name_and_code %> at <%= application_choice.current_course_option.provider.name %>
<% end %>
diff --git a/app/components/support_interface/application_choice_component.rb b/app/components/support_interface/application_choice_component.rb
index bd8b36c4446..7f9c39d620f 100644
--- a/app/components/support_interface/application_choice_component.rb
+++ b/app/components/support_interface/application_choice_component.rb
@@ -41,7 +41,12 @@ def application_number_row
def status_row
{
key: 'Status',
- value: render(SupportInterface::ApplicationStatusTagComponent.new(status: application_choice.status)),
+ value: render(
+ SupportInterface::ApplicationStatusTagComponent.new(
+ status: application_choice.status,
+ supplementary_statuses: supplementary_statuses_for(application_choice:),
+ ),
+ ),
}.merge(status_action_link)
end
diff --git a/app/components/support_interface/application_status_tag_component.html.erb b/app/components/support_interface/application_status_tag_component.html.erb
index a32d93128a1..9d581972d8c 100644
--- a/app/components/support_interface/application_status_tag_component.html.erb
+++ b/app/components/support_interface/application_status_tag_component.html.erb
@@ -1 +1,4 @@
<%= govuk_tag(text: text, colour: colour) %>
+<% supplementary_tags do |supplementary_tag_text, supplementary_tag_colour| %>
+ <%= govuk_tag(text: supplementary_tag_text, colour: supplementary_tag_colour) %>
+<% end %>
diff --git a/app/components/support_interface/application_status_tag_component.rb b/app/components/support_interface/application_status_tag_component.rb
index 3a2858b9a06..2dfbda9f93d 100644
--- a/app/components/support_interface/application_status_tag_component.rb
+++ b/app/components/support_interface/application_status_tag_component.rb
@@ -1,7 +1,8 @@
module SupportInterface
class ApplicationStatusTagComponent < ViewComponent::Base
- def initialize(status:)
+ def initialize(status:, supplementary_statuses: [])
@status = status
+ @supplementary_statuses = supplementary_statuses
end
def text
@@ -26,5 +27,26 @@ def colour
raise "You need to define a colour for the #{@status} state"
end
end
+
+ def supplementary_tags
+ @supplementary_statuses.each do |supplementary_status|
+ yield supplementary_tag_text(supplementary_status), supplementary_tag_colour(supplementary_status)
+ end
+ end
+
+ private
+
+ def supplementary_tag_text(supplementary_status)
+ I18n.t!("supplementary_application_states.#{supplementary_status}.name")
+ end
+
+ def supplementary_tag_colour(supplementary_status)
+ case supplementary_status.to_s
+ when 'ske_pending_conditions'
+ 'blue'
+ else
+ raise "You need to define a colour for the #{supplementary_status} supplementary state"
+ end
+ end
end
end
diff --git a/app/helpers/view_helper.rb b/app/helpers/view_helper.rb
index 25d49bad164..3b33984691b 100644
--- a/app/helpers/view_helper.rb
+++ b/app/helpers/view_helper.rb
@@ -144,6 +144,15 @@ def application_form_path
BackLinks.application_form_path
end
+ def supplementary_statuses_for(application_choice:)
+ [].tap do |supplementary_statuses|
+ if application_choice.recruited? &&
+ RecruitedWithPendingConditions.new(application_choice:).call
+ supplementary_statuses << :ske_pending_conditions
+ end
+ end
+ end
+
private
def back_link_url
diff --git a/app/services/can_recruit_with_pending_conditions.rb b/app/services/can_recruit_with_pending_conditions.rb
index 38b43dde8fb..4704ab7194f 100644
--- a/app/services/can_recruit_with_pending_conditions.rb
+++ b/app/services/can_recruit_with_pending_conditions.rb
@@ -1,38 +1,13 @@
-class CanRecruitWithPendingConditions
- attr_accessor :application_choice
-
- def initialize(application_choice:)
- self.application_choice = application_choice
- end
-
+class CanRecruitWithPendingConditions < HasPendingSkeConditionsOnly
def call
- feature_flag_enabled? &&
- application_has_offer? &&
- offer_has_pending_ske_conditions? &&
- all_non_ske_conditions_met? &&
+ application_choice.pending_conditions? &&
+ pending_ske_conditions_only? &&
provider_is_scitt? &&
course_is_within_time_limit?
end
private
- def feature_flag_enabled?
- FeatureFlag.active?(:recruit_with_pending_conditions)
- end
-
- def application_has_offer?
- application_choice.offer.present?
- end
-
- def offer_has_pending_ske_conditions?
- application_choice.offer.ske_conditions.any?(&:pending?)
- end
-
- def all_non_ske_conditions_met?
- non_ske_conditions = application_choice.offer.conditions - application_choice.offer.ske_conditions
- non_ske_conditions.all?(&:met?)
- end
-
def provider_is_scitt?
application_choice.provider&.scitt?
end
diff --git a/app/services/has_pending_ske_conditions_only.rb b/app/services/has_pending_ske_conditions_only.rb
new file mode 100644
index 00000000000..7e248faddb3
--- /dev/null
+++ b/app/services/has_pending_ske_conditions_only.rb
@@ -0,0 +1,35 @@
+class HasPendingSkeConditionsOnly
+ attr_accessor :application_choice
+
+ def initialize(application_choice:)
+ self.application_choice = application_choice
+ end
+
+ def pending_ske_conditions_only?
+ feature_flag_enabled? &&
+ application_has_offer? &&
+ offer_has_pending_ske_conditions? &&
+ all_non_ske_conditions_met?
+ end
+
+private
+
+ def feature_flag_enabled?
+ FeatureFlag.active?(:recruit_with_pending_conditions)
+ end
+
+ def application_has_offer?
+ application_choice.offer.present?
+ end
+
+ def offer_has_pending_ske_conditions?
+ application_choice.offer.conditions.any? do |condition|
+ condition.is_a?(SkeCondition) && condition.pending?
+ end
+ end
+
+ def all_non_ske_conditions_met?
+ non_ske_conditions = application_choice.offer.conditions - application_choice.offer.ske_conditions
+ non_ske_conditions.all?(&:met?)
+ end
+end
diff --git a/app/services/recruited_with_pending_conditions.rb b/app/services/recruited_with_pending_conditions.rb
new file mode 100644
index 00000000000..402ace57c00
--- /dev/null
+++ b/app/services/recruited_with_pending_conditions.rb
@@ -0,0 +1,5 @@
+class RecruitedWithPendingConditions < HasPendingSkeConditionsOnly
+ def call
+ application_choice.recruited? && pending_ske_conditions_only?
+ end
+end
diff --git a/app/views/provider_interface/offer/recruit_with_pending_conditions/new.html.erb b/app/views/provider_interface/offer/recruit_with_pending_conditions/new.html.erb
index c13b1e88680..6d9ce31fa25 100644
--- a/app/views/provider_interface/offer/recruit_with_pending_conditions/new.html.erb
+++ b/app/views/provider_interface/offer/recruit_with_pending_conditions/new.html.erb
@@ -2,7 +2,12 @@
<%= @application_choice.application_form.full_name %>
- <%= render(ProviderInterface::ApplicationStatusTagComponent.new(application_choice: @application_choice)) %>
+ <%= render(
+ ProviderInterface::ApplicationStatusTagComponent.new(
+ application_choice: @application_choice,
+ supplementary_statuses: supplementary_statuses_for(application_choice: @application_choice),
+ ),
+ ) %>
<%= form_with(
diff --git a/config/locales/application_states.yml b/config/locales/application_states.yml
index ac821dc4084..4807c8c22c9 100644
--- a/config/locales/application_states.yml
+++ b/config/locales/application_states.yml
@@ -221,6 +221,11 @@ en:
emails:
- candidate_mailer-deferred_offer_reminder
+ supplementary_application_states:
+ ske_pending_conditions:
+ name: SKE conditions pending
+ description: Provider is waiting for the candidate to meet one or more SKE conditions.
+
events:
unsubmitted-send_to_provider:
name: Candidate submits
diff --git a/spec/components/candidate_interface/application_status_tag_component_spec.rb b/spec/components/candidate_interface/application_status_tag_component_spec.rb
index 51dbbd47d68..8a9d2eb2252 100644
--- a/spec/components/candidate_interface/application_status_tag_component_spec.rb
+++ b/spec/components/candidate_interface/application_status_tag_component_spec.rb
@@ -224,4 +224,13 @@
end
end
end
+
+ it 'renders with `ske_pending_condition` supplementary status for `recruited` applications' do
+ result = render_inline described_class.new(
+ application_choice: build_stubbed(:application_choice, status: :recruited),
+ supplementary_statuses: [:ske_pending_conditions],
+ )
+ expect(result.text).to include('Offer confirmed')
+ expect(result.text).to include('SKE conditions pending')
+ end
end
diff --git a/spec/components/provider_interface/application_status_tag_component_spec.rb b/spec/components/provider_interface/application_status_tag_component_spec.rb
index 23643178093..27a15625382 100644
--- a/spec/components/provider_interface/application_status_tag_component_spec.rb
+++ b/spec/components/provider_interface/application_status_tag_component_spec.rb
@@ -6,4 +6,13 @@
render_inline described_class.new(application_choice: build_stubbed(:application_choice, status: state_name))
end
end
+
+ it 'renders with `ske_pending_condition` supplementary status for `recruited` applications' do
+ result = render_inline described_class.new(
+ application_choice: build_stubbed(:application_choice, status: :recruited),
+ supplementary_statuses: [:ske_pending_conditions],
+ )
+ expect(result.text).to include('Recruited')
+ expect(result.text).to include('SKE conditions pending')
+ end
end
diff --git a/spec/components/provider_interface/offer_summary_component_spec.rb b/spec/components/provider_interface/offer_summary_component_spec.rb
index 144fd73817d..50c4dece2c6 100644
--- a/spec/components/provider_interface/offer_summary_component_spec.rb
+++ b/spec/components/provider_interface/offer_summary_component_spec.rb
@@ -192,7 +192,7 @@ def row_link_selector(row_number)
end
end
- context 'when application is in condititions_pending state but only SKE conditions are pending' do
+ context 'when application is in conditions_pending state but only SKE conditions are pending' do
let(:application_choice) { build_stubbed(:application_choice, :accepted) }
before { allow(CanRecruitWithPendingConditions).to receive(:new).and_return(instance_double(CanRecruitWithPendingConditions, call: true)) }
diff --git a/spec/components/support_interface/application_status_tag_component_spec.rb b/spec/components/support_interface/application_status_tag_component_spec.rb
index 08f58b1a171..9fe0e3e8522 100644
--- a/spec/components/support_interface/application_status_tag_component_spec.rb
+++ b/spec/components/support_interface/application_status_tag_component_spec.rb
@@ -6,4 +6,13 @@
render_inline described_class.new(status: state_name.to_s)
end
end
+
+ it 'renders with `ske_pending_condition` supplementary status for `recruited` applications' do
+ result = render_inline described_class.new(
+ status: :recruited,
+ supplementary_statuses: [:ske_pending_conditions],
+ )
+ expect(result.text).to include('Recruited')
+ expect(result.text).to include('SKE conditions pending')
+ end
end
diff --git a/spec/factories/offer.rb b/spec/factories/offer.rb
index 40627de20ff..fd225fb4072 100644
--- a/spec/factories/offer.rb
+++ b/spec/factories/offer.rb
@@ -15,6 +15,8 @@
end
trait :with_ske_conditions do
+ application_choice { association(:application_choice, :pending_conditions, offer: instance) }
+
conditions {
[
build(:text_condition),
diff --git a/spec/helpers/view_helper_spec.rb b/spec/helpers/view_helper_spec.rb
index a9ad4eda091..8bd90bb2c2f 100644
--- a/spec/helpers/view_helper_spec.rb
+++ b/spec/helpers/view_helper_spec.rb
@@ -206,4 +206,18 @@
expect(helper.formatted_percentage(1, 0)).to eq '-'
end
end
+
+ describe '#supplementary_statuses_for' do
+ let(:service) { instance_double(CanRecruitWithPendingConditions, call: true) }
+
+ before { allow(RecruitedWithPendingConditions).to receive(:new).and_return(service) }
+
+ it 'returns an empty array if the status is not `recruited`' do
+ expect(helper.supplementary_statuses_for(application_choice: build(:application_choice, :offer))).to eq([])
+ end
+
+ it 'returns `ske_pending_conditions` if the status is `recruited`' do
+ expect(helper.supplementary_statuses_for(application_choice: build(:application_choice, :recruited))).to eq([:ske_pending_conditions])
+ end
+ end
end
diff --git a/spec/services/can_recruit_with_pending_conditions_spec.rb b/spec/services/can_recruit_with_pending_conditions_spec.rb
index 7ee8df8c1a7..74ab69fc131 100644
--- a/spec/services/can_recruit_with_pending_conditions_spec.rb
+++ b/spec/services/can_recruit_with_pending_conditions_spec.rb
@@ -23,14 +23,6 @@
context 'when feature flag is on' do
before { FeatureFlag.activate(:recruit_with_pending_conditions) }
- context 'when there are various pending conditions' do
- let(:offer) { create(:offer, :with_unmet_conditions) }
-
- it 'returns false' do
- expect(service.call).to be(false)
- end
- end
-
context 'when there is a pending SKE condition and other met conditions' do
let(:offer) { create(:offer, :with_ske_conditions) }
@@ -48,6 +40,16 @@
end
end
+ context 'when the application choice is already `recruited`' do
+ before do
+ offer.application_choice.recruited!
+ end
+
+ it 'returns false if the status is already `recruited`' do
+ expect(service.call).to be(false)
+ end
+ end
+
context 'when the provider is NOT a SCITT and the course start date is within 3 months' do
before do
offer.application_choice.provider.update(provider_type: :university)
diff --git a/spec/services/recruited_with_pending_conditions_spec.rb b/spec/services/recruited_with_pending_conditions_spec.rb
new file mode 100644
index 00000000000..69048c5080e
--- /dev/null
+++ b/spec/services/recruited_with_pending_conditions_spec.rb
@@ -0,0 +1,44 @@
+require 'rails_helper'
+
+RSpec.describe RecruitedWithPendingConditions do
+ let(:offer) { create(:offer) }
+
+ subject(:service) { described_class.new(application_choice: offer.application_choice) }
+
+ context 'when feature flag is off' do
+ let(:offer) { create(:offer, :with_ske_conditions) }
+
+ before do
+ offer.conditions.reject { |condition| condition.is_a?(SkeCondition) }.each do |condition|
+ condition.update!(status: :met)
+ end
+ end
+
+ it 'returns false' do
+ expect(service.call).to be(false)
+ end
+ end
+
+ context 'when feature flag is on' do
+ before { FeatureFlag.activate(:recruit_with_pending_conditions) }
+
+ context 'when there is a pending SKE condition and other met conditions' do
+ let(:offer) { create(:offer, :with_ske_conditions) }
+
+ before do
+ offer.conditions.reject { |condition| condition.is_a?(SkeCondition) }.each do |condition|
+ condition.update!(status: :met)
+ end
+ end
+
+ it 'returns false if the status is `pending_conditions`' do
+ expect(service.call).to be(false)
+ end
+
+ it 'returns true if the status is `recruited`' do
+ offer.application_choice.recruited!
+ expect(service.call).to be(true)
+ end
+ end
+ end
+end