Skip to content

Commit

Permalink
Merge pull request #259 from NUBIC/3450_develop_mold_question_show_18M
Browse files Browse the repository at this point in the history
18MonthMother Display Mold Question V3 Dependency #3450
  • Loading branch information
phebal committed Jul 15, 2013
2 parents e410b66 + 7e2d59c commit e1e4c89
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/response_set_prepopulation/postnatal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def get_last_response_as_string(data_export_identifier)
end

def is_response_to_mold_question_yes?
get_last_response_as_string(
"EIGHTEEN_MTH_MOTHER_2.MOLD") == NcsCode::YES.to_s
d_identifiers = %w(EIGHTEEN_MTH_MOTHER_3.MOLD EIGHTEEN_MTH_MOTHER_2.MOLD)
d_identifiers.any?{|d_identifier| get_last_response_as_string(d_identifier) == NcsCode::YES.to_s}
end

def were_there_no_prenatal_events?
Expand Down
50 changes: 50 additions & 0 deletions spec/models/response_set_prepopulation/postnatal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,56 @@ def have_children(quantity)
end
end

context "for 18MM v3.x prepopulators"
describe "prepopulated_should_show_upper_arm_length" do
before(:each) do
@survey = create_generic_true_false_prepopulator_survey(
"INS_QUE_18MMother_INT_EHPBHI_M3.1_V3.0_EIGHTEEN_MTH_MOTHER_MOLD",
"prepopulated_should_show_room_mold_child")
init_common_vars
end

it "should be TRUE if response to MOLD question was YES" do
prepare_and_take_survey("EIGHTEEN_MTH_MOTHER_3.MOLD", 1,
:create_18mm_v3_survey_part_three_for_mold_prepopulators)
run_populator
get_response_as_string(@response_set,
"prepopulated_should_show_room_mold_child"
).should == "TRUE"
end
it "should be FALSE if response to MOLD question was NO" do
prepare_and_take_survey("EIGHTEEN_MTH_MOTHER_3.MOLD", 2,
:create_18mm_v3_survey_part_three_for_mold_prepopulators)
run_populator
get_response_as_string(@response_set,
"prepopulated_should_show_room_mold_child"
).should == "FALSE"
end

it "should be FALSE if response to MOLD question was REFUSED" do
prepare_and_take_survey("EIGHTEEN_MTH_MOTHER_3.MOLD", "neg_1",
:create_18mm_v3_survey_part_three_for_mold_prepopulators)
run_populator
get_response_as_string(@response_set,
"prepopulated_should_show_room_mold_child"
).should == "FALSE"
end
it "should be FALSE if response to MOLD question was REFUSED" do
prepare_and_take_survey("EIGHTEEN_MTH_MOTHER_3.MOLD", "neg_2",
:create_18mm_v3_survey_part_three_for_mold_prepopulators)
run_populator
get_response_as_string(@response_set,
"prepopulated_should_show_room_mold_child"
).should == "FALSE"
end
it "should be FALSE if 18MM part 3 survey was not completed" do
run_populator
get_response_as_string(@response_set,
"prepopulated_should_show_room_mold_child"
).should == "FALSE"
end
end

context "for 30M M3.1 prepopulators"
describe "prepopulated_is_child_num_gt_or_eq_one_for_first_child" do
before(:each) do
Expand Down
22 changes: 22 additions & 0 deletions spec/support/test_surveys/post_natal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,28 @@ def create_18mm_v2_survey_part_three_for_mold_prepopulators
survey
end

def create_18mm_v3_survey_part_three_for_mold_prepopulators
survey = Factory(:survey,
title: "INS_QUE_18Month_INT_EHPBHILIPBS_M3.1_V3.0_PART_TWO",
access_code: "ins_que_18mmother_int_ehpbhi_m3_1_V3_0_part_two")
survey_section = Factory(:survey_section, :survey_id => survey.id)
q = Factory(:question,
:text => "In the last 6 months, have you seen any mold or mildew on walls or other surfaces, other than the shower or bathtub,
inside your home?",
:reference_identifier => "MOLD",
:data_export_identifier => "EIGHTEEN_MTH_MOTHER_3.MOLD",
:survey_section_id => survey_section.id)
a = Factory(:answer, :question_id => q.id, :reference_identifier => "1",
:text => "YES", :response_class => "answer")
a = Factory(:answer, :question_id => q.id, :reference_identifier => "2",
:text => "NO", :response_class => "answer")
a = Factory(:answer, :question_id => q.id, :text => "REFUSED",
:response_class => "answer", :reference_identifier => "neg_1")
a = Factory(:answer, :question_id => q.id, :text => "DON'T KNOW",
:response_class => "answer", :reference_identifier => "neg_2")
survey
end

def create_pm_child_anthr_survey_for_6_month_event
survey = Factory(:survey,
:title => "INS_PM_ChildAnthro_DCI_EHPBHI_M3.1_V1.0",
Expand Down

0 comments on commit e1e4c89

Please sign in to comment.