Sha256: fde5eee2f4451fe520ecacf93e6896bcfabb3c52592b565aea9abddbc9057079

Contents?: true

Size: 870 Bytes

Versions: 28

Compression:

Stored size: 870 Bytes

Contents

module Spreedly

  module Assertions

    def assert_raise_with_message(expected_exception_type, expected_message)
      error = assert_raises(expected_exception_type) do
        yield
      end
      assert_equal expected_message, error.message, "Exception message is incorrect"
    end

    def assert_invalid_login
      environment = Spreedly::Environment.new("UnknownEnvironmentKey", "UnknownAccessSecret")

      assert_raise_with_message(Spreedly::AuthenticationError, "Unable to authenticate using the given environment_key and access_token.  Please check your credentials.") do
        yield(environment)
      end
    end

    def assert_xpaths_in(xml_doc, *xpaths)
      xpaths.each do |xpath, expected_text|
        assert_equal expected_text, xml_doc.xpath(xpath).text, "Looking for the text of the following xpath: #{xpath}"
      end
    end

  end


end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
spreedly-2.0.28 test/helpers/assertions.rb
spreedly-2.0.27 test/helpers/assertions.rb
spreedly-2.0.26 test/helpers/assertions.rb
spreedly-2.0.25 test/helpers/assertions.rb
spreedly-2.0.24 test/helpers/assertions.rb
spreedly-2.0.23 test/helpers/assertions.rb
spreedly-2.0.22 test/helpers/assertions.rb
spreedly-2.0.21 test/helpers/assertions.rb
spreedly-2.0.20 test/helpers/assertions.rb
spreedly-2.0.19 test/helpers/assertions.rb
spreedly-2.0.18 test/helpers/assertions.rb
spreedly-2.0.17 test/helpers/assertions.rb
spreedly-2.0.16 test/helpers/assertions.rb
spreedly-2.0.15 test/helpers/assertions.rb
spreedly-2.0.14 test/helpers/assertions.rb
spreedly-2.0.13 test/helpers/assertions.rb
spreedly-2.0.11 test/helpers/assertions.rb
spreedly-2.0.10 test/helpers/assertions.rb
spreedly-2.0.9 test/helpers/assertions.rb
spreedly-2.0.8 test/helpers/assertions.rb