Sha256: 772d3496091594d9d46d2dec02b6af4419ef6a5a0302e648155d4977058a99d0

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

# encoding: UTF-8
require 'minitest/autorun'
require 'minitest/pride'
require 'mocha/setup'
require 'capybara/poltergeist'

require 'adyen'
require 'adyen/matchers'

require 'helpers/configure_adyen'
require 'helpers/example_server'
require 'helpers/test_cards'

require 'pp'

module Adyen::Test
  module Flaky
    def flaky_test(name, &block)
      define_method("test_#{name}") do
        attempt = 0
        test_instance = self
        begin
          attempt += 1
          test_instance.instance_eval(&block)
        rescue Minitest::Assertion
          attempt < 3 ? retry : raise
        end
      end
    end
  end

  module EachXMLBackend
    XML_BACKENDS = [Adyen::API::XMLQuerier::NokogiriBackend, Adyen::API::XMLQuerier::REXMLBackend]

    def for_each_xml_backend(&block)
      XML_BACKENDS.each do |xml_backend|
        begin
          Adyen::API::XMLQuerier.stubs(:default_backend).returns(xml_backend.new)
          block.call(xml_backend)
        ensure
          Adyen::API::XMLQuerier.unstub(:default_backend)
        end
      end
    end
  end
end



Capybara.register_driver :poltergeist do |app|
  Capybara::Poltergeist::Driver.new(app, phantomjs_options: ['--ssl-protocol=any'])
end

Capybara.default_driver = :poltergeist
Capybara.javascript_driver = :poltergeist
Capybara.app = Adyen::ExampleServer

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adyen-2.0.0 test/test_helper.rb
adyen-2.0.0.pre2 test/test_helper.rb
adyen-2.0.0.pre1 test/test_helper.rb