service_helpers.rb 517 B

123456789101112131415161718
  1. module ServiceHelpers
  2. def stub_civicrm
  3. Rails.application.secrets.supporters["host"] = "https://civicrm.test"
  4. stub_request(:post, CiviCRM::supporters_api_url).
  5. and_return(status: 200, body: "{}", headers: {})
  6. stub_request(:post, CiviCRM::supporters_api_url).
  7. with(body: /generate_checksum/).
  8. and_return(status: 200, body: { checksum: "xyz" }.to_json, headers: {})
  9. end
  10. end
  11. RSpec.configure do |c|
  12. c.include ServiceHelpers
  13. end
  14. World(ServiceHelpers) if respond_to?(:World) #cucumber