Sha256: d8b35266750fc1bf2776b84b02020c33ce7bd42451ae53ee8d86f6ffd0cf2c65

Contents?: true

Size: 943 Bytes

Versions: 19

Compression:

Stored size: 943 Bytes

Contents

# frozen_string_literal: true

def create_new_answer_for(questionnaire, answer_value = {}, flags: {}, textvars: {})
  allow_any_instance_of(Quby::AnswersController).to receive(:verify_hmac).and_return(true)
  allow_any_instance_of(Quby::AnswersController).to receive(:verify_token).and_return(true)
  Quby.answers.create!(questionnaire.key, value: answer_value, flags: flags, textvars: textvars)
end

def visit_new_answer_for(questionnaire, mode = "paged", answer = nil, params = {})
  allow(Quby::Settings).to receive(:authorize_with_hmac).and_return(false)
  allow(Quby::Settings).to receive(:authorize_with_id_from_session).and_return(false)
  allow(Quby::Settings).to receive(:enable_leave_page_alert).and_return(false)

  answer ||= create_new_answer_for(questionnaire)
  visit "/quby/questionnaires/#{questionnaire.key}/answers/#{answer.id}/edit?display_mode=#{mode}" \
        "#{'&' + params.to_query if params.present?}"
  answer
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
quby-5.0.5 spec/support/request_helpers.rb
quby-5.0.4 spec/support/request_helpers.rb
quby-5.0.3 spec/support/request_helpers.rb
quby-5.0.2 spec/support/request_helpers.rb
quby-5.0.1 spec/support/request_helpers.rb
quby-5.0.0 spec/support/request_helpers.rb
quby-4.0.4 spec/support/request_helpers.rb
quby-5.0.0.pre4 spec/support/request_helpers.rb
quby-5.0.0.pre3 spec/support/request_helpers.rb
quby-5.0.0.pre2 spec/support/request_helpers.rb
quby-5.0.0.pre1 spec/support/request_helpers.rb
quby-4.0.3 spec/support/request_helpers.rb
quby-4.0.2 spec/support/request_helpers.rb
quby-4.0.1 spec/support/request_helpers.rb
quby-4.0.0 spec/support/request_helpers.rb
quby-3.2.2 spec/support/request_helpers.rb
quby-3.2.1 spec/support/request_helpers.rb
quby-3.2.0 spec/support/request_helpers.rb
quby-3.2.0.pre.pre1 spec/support/request_helpers.rb