Skip to content

Commit

Permalink
update spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jayreddy519 committed May 31, 2024
1 parent 6a15dd3 commit 787ac5a
Showing 1 changed file with 2 additions and 58 deletions.
60 changes: 2 additions & 58 deletions spec/models/enrollment_action/dependent_add_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
let(:amqp_connection) { double }
let(:event_xml) { double }
let(:event_responder) { instance_double(::ExternalEvents::EventResponder, :connection => amqp_connection) }
let(:enrollee_primary) { double(:m_id => 1, :coverage_start => :one_month_ago, :coverage_status => 'active') }
let(:enrollee_new) { double(:m_id => 2, :coverage_start => :one_month_ago, :coverage_status => 'active') }
let(:enrollee_primary) { double(:m_id => 1, :coverage_start => :one_month_ago) }
let(:enrollee_new) { double(:m_id => 2, :coverage_start => :one_month_ago) }

let(:plan) { instance_double(Plan, :id => 1) }
let(:carrier) { instance_double(Carrier, :renewal_dependent_add_transmitted_as_renewal => true) }
Expand Down Expand Up @@ -158,62 +158,6 @@
end
end

describe EnrollmentAction::DependentAdd, "given a qualified enrollment set, with active & inactive enrollees" do
let(:amqp_connection) { double }
let(:event_xml) { double }
let(:event_responder) { instance_double(::ExternalEvents::EventResponder, :connection => amqp_connection) }
let(:enrollee_primary) { double(:m_id => 1, :coverage_start => :one_month_ago, :coverage_status => 'active') }
let(:enrollee_new) { double(:m_id => 2, :coverage_start => :one_month_ago, :coverage_status => nil) }

let(:plan) { instance_double(Plan, :id => 1) }
let(:carrier) { instance_double(Carrier, :renewal_dependent_add_transmitted_as_renewal => true) }
let(:policy) { instance_double(Policy, :enrollees => [enrollee_primary, enrollee_new], :eg_id => 1, carrier: carrier) }
let(:active_policy) { instance_double(Policy) }

let(:dependent_add_event) { instance_double(
::ExternalEvents::EnrollmentEventNotification,
:event_xml => event_xml,
:all_member_ids => [1,2],
:hbx_enrollment_id => 2,
employer_hbx_id: 1
) }
let(:termination_event) { instance_double(
::ExternalEvents::EnrollmentEventNotification,
:existing_policy => policy,
:all_member_ids => [1],
:event_responder => event_responder,
:hbx_enrollment_id => 1,
:employer_hbx_id => 1
) }
let(:action_helper_result_xml) { double }

let(:action_publish_helper) { instance_double(
EnrollmentAction::ActionPublishHelper,
:to_xml => action_helper_result_xml
) }

before :each do
allow(EnrollmentAction::ActionPublishHelper).to receive(:new).with(event_xml).and_return(action_publish_helper)
allow(action_publish_helper).to receive(:set_policy_id).with(1).and_return(true)
allow(action_publish_helper).to receive(:filter_affected_members).with([2]).and_return(true)
allow(action_publish_helper).to receive(:set_event_action).with("urn:openhbx:terms:v1:enrollment#change_member_add")
allow(action_publish_helper).to receive(:set_member_starts).with({ 1 => :one_month_ago, 2 => :one_month_ago })
allow(action_publish_helper).to receive(:keep_member_ends).with([])
allow(subject).to receive(:publish_edi).with(amqp_connection, action_helper_result_xml, termination_event.hbx_enrollment_id, termination_event.employer_hbx_id)
allow(subject).to receive(:same_carrier_renewal_candidates).with(dependent_add_event).and_return([active_policy])
allow(dependent_add_event).to receive(:dep_add_or_drop_to_renewal_policy?).with(active_policy, policy).and_return(false)
end

subject do
EnrollmentAction::DependentAdd.new(termination_event, dependent_add_event)
end

it "sets member start dates" do
expect(action_publish_helper).to receive(:set_member_starts).with({ 1 => :one_month_ago})
subject.publish
end
end

describe "given renewal event, dependent adding to IVL renewal policy", :dbclean => :after_each do
let(:amqp_connection) { double }
let(:event_xml) { double }
Expand Down

0 comments on commit 787ac5a

Please sign in to comment.