Skip to content

Instantly share code, notes, and snippets.

@hannahwhy
Created July 16, 2013 21:50
Show Gist options
  • Save hannahwhy/6015462 to your computer and use it in GitHub Desktop.
Save hannahwhy/6015462 to your computer and use it in GitHub Desktop.
Instrument -> Warehouse stuff
From d8daabd5dd370ee6d262888756233c0aca1443c9 Mon Sep 17 00:00:00 2001
From: David Yip <yipdw@member.fsf.org>
Date: Tue, 16 Jul 2013 21:44:34 +0000
Subject: [PATCH] A spec to demonstrate an issue with question fill-ins.
Related data issues:
* https://code.bioinformatics.northwestern.edu/redmine/issues/show/9680
* https://code.bioinformatics.northwestern.edu/redmine/issues/show/9697
(maybe)
---
.../core/warehouse/instrument_to_warehouse_spec.rb | 32 ++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/spec/lib/ncs_navigator/core/warehouse/instrument_to_warehouse_spec.rb b/spec/lib/ncs_navigator/core/warehouse/instrument_to_warehouse_spec.rb
index 849ab74..d23fd72 100644
--- a/spec/lib/ncs_navigator/core/warehouse/instrument_to_warehouse_spec.rb
+++ b/spec/lib/ncs_navigator/core/warehouse/instrument_to_warehouse_spec.rb
@@ -936,6 +936,38 @@ module NcsNavigator::Core::Warehouse
sb2.time_stamp_2.should == '2000-01-01T12:34:56'
end
end
+
+ describe 'when a non-coded question is the only response in a set' do
+ include NcsNavigator::Core::Surveyor::SurveyTaker
+
+ let(:record) { records.find { |rec| rec.class.mdes_table_name == 'three_mth_mother' } }
+
+ let(:questions_dsl) do
+ <<-END
+ q_prepopulated_foobar "foobar"
+ a :integer
+
+ q_ETHNICITY "Do you consider yourself to be Hispanic, or Latina?", :pick => :one,
+ :data_export_identifier=>"THREE_MTH_MOTHER.ETHNICITY"
+ a_1 "Yes"
+ a_2 "No"
+ a_neg_1 "Refused"
+ a_neg_2 "Don't know"
+ END
+ end
+
+ before do
+ respond(response_set) do |r|
+ r.answer 'prepopulated_foobar', :value => 42
+ end
+
+ response_set.save!
+ end
+
+ it 'fills in missing values for exported questions where possible' do
+ record.ethnicity.should == '-4'
+ end
+ end
end
describe 'for a multiple-survey instrument' do
--
1.7.9.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment