spec/resource_spec.rb in survey-gizmo-ruby-6.2.9 vs spec/resource_spec.rb in survey-gizmo-ruby-6.2.10

- old
+ new

@@ -248,20 +248,21 @@ 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 (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(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), question_pipe(10527)]' => 'This product was too expensive', # Sometimes surveygizmo only includes the option with the "other" answer. =( - '[question(11)]' => 'Other - Please explain', - '[question(11), option("10017-other")]' => 'I understood...' + '[question(12)]' => 'Other - Please explain', + '[question(12), option("10017-other")]' => 'I understood...' } end it 'should propagate time, survey_id, and response_id' do response = described_class.new( @@ -273,15 +274,16 @@ expect(response.parsed_answers.map { |a| a.to_hash }).to eq([ { survey_id: survey_id, response_id: response_id, question_id: 5, answer_text: "VERY important", submitted_at: timestamp }]) end it 'should parse the answers and remove extraneous answers' do 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: 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: 11, option_id: 10017, other_text: "I understood..." } + { survey_id: 1, question_id: 11, question_pipe: '10527', answer_text: 'This product was too expensive' }, + { survey_id: 1, question_id: 12, option_id: 10017, other_text: 'I understood...' } ]) end end end