spec/resource_spec.rb in survey-gizmo-ruby-6.2.3 vs spec/resource_spec.rb in survey-gizmo-ruby-6.2.4
- old
+ new
@@ -247,19 +247,21 @@
let(:survey_id) { 6 }
let(:response_id) { 7 }
let(:timestamp) { '2015-01-02'.to_time(:utc) }
let(:answers) do
{
- "[question(3), option(\"10021-other\")]" => "Some other text field answer",
+ '[question(3), option("10021-other")]' => 'Some other text field answer',
"[question(3), option(10021)]" => "Other (required)",
"[question(5)]" => "VERY important",
"[question(6)]" => nil,
"[question(7), option(10001)]" => nil,
"[question(8)]" => false,
"[question(9), option(10002)]" => '16',
"[question(10), question_pipe(\"Que aplicación\")]" => "5 = Extremely important",
- "[question(11), option(10001)]" => ""
+ # Sometimes surveygizmo only includes the option with the "other" answer. =(
+ '[question(11)]' => 'Other - Please explain',
+ '[question(11), option("10017-other")]' => 'I understood...'
}
end
it 'should propagate time, survey_id, and response_id' do
response = described_class.new(
@@ -275,10 +277,11 @@
expect(described_class.new(answers: answers, survey_id: 1).parsed_answers.map { |a| a.to_hash }).to eq([
{ survey_id: 1, question_id: 3, option_id: 10021, other_text: "Some other text field answer" },
{ survey_id: 1, question_id: 5, answer_text: "VERY important" },
{ survey_id: 1, question_id: 8, answer_text: 'false' },
{ survey_id: 1, question_id: 9, option_id: 10002 },
- { survey_id: 1, question_id: 10, question_pipe: "Que aplicación", answer_text: "5 = Extremely important" }
+ { survey_id: 1, question_id: 10, question_pipe: 'Que aplicación', answer_text: '5 = Extremely important' },
+ { survey_id: 1, question_id: 11, option_id: 10017, other_text: "I understood..." }
])
end
end
end