Sha256: ba07a7dd11c4aef8274228730d9cb1d9cd8424619f581849d6c5c505c2d73a59

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

# -*- coding: utf-8 -*-
require File.expand_path('../../test_helper', __FILE__)

module Peakium
  class CustomerTest < Test::Unit::TestCase
    should "gateways should be listable" do
      @mock.expects(:get).once.returns(test_response(test_gateway_array))
      g = Peakium::Gateway.all.data
      assert g.kind_of? Array
      assert g[0].kind_of? Peakium::Gateway
    end

    should "gateway should have GatewayModule objects associated with their module property" do
      @mock.expects(:get).once.returns(test_response(test_gateway))
      g = Peakium::Gateway.retrieve("gw_test_gateway")
      assert g.module.kind_of?(Peakium::PeakiumObject) && g.module.object == 'gateway_module'
    end

    should "gateways should be updateable" do
      @mock.expects(:get).once.returns(test_response(test_gateway({:mnemonic => "foo"})))
      @mock.expects(:post).once.returns(test_response(test_gateway({:mnemonic => "bar"})))
      g = Peakium::Gateway.new("test_gateway").refresh
      assert_equal g.mnemonic, "foo"
      g.mnemonic = "bar"
      g.save
      assert_equal g.mnemonic, "bar"
    end

    should "create should return a new gateway" do
      @mock.expects(:post).once.returns(test_response(test_gateway))
      g = Peakium::Gateway.create
      assert_equal "gw_test_gateway", g.id
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
peakium-0.1.4 test/peakium/gateway_test.rb
peakium-0.1.3 test/peakium/gateway_test.rb
peakium-0.1.2 test/peakium/gateway_test.rb
peakium-0.1.1 test/peakium/gateway_test.rb