Sha256: 26d825be281910a17effb297abd2f1170a96984f9a316939f2fc4bb5f793de19

Contents?: true

Size: 1021 Bytes

Versions: 12

Compression:

Stored size: 1021 Bytes

Contents

require File.expand_path('../../test_helper', __FILE__)

module Payjp
  class TokenTest < Test::Unit::TestCase
    should "create should return a new token" do
      @mock.expects(:post).once.returns(test_response(test_token))
      token = Payjp::Token.create({
        :card => {
          :number => '4242424242424242',
          :exp_month => 2,
          :exp_year => 2020
        }
      })
      assert_equal Payjp::Token, token.class
      assert_equal 'tok_test_token', token.id
    end

    should "retrieve should retrieve token" do
      @mock.expects(:get).once.returns(test_response(test_token))
      token = Payjp::Token.retrieve('tok_test_token')

      assert_equal Payjp::Token, token.class
      assert_equal 'tok_test_token', token.id
    end

    should "token should not be deletable" do
      assert_raises NoMethodError do
        @mock.expects(:get).once.returns(test_response(test_token))
        token = Payjp::Token.retrieve('tok_test_token')
        token.delete
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
payjp-0.0.14 test/payjp/token_test.rb
payjp-0.0.13 test/payjp/token_test.rb
payjp-0.0.12 test/payjp/token_test.rb
payjp-0.0.10 test/payjp/token_test.rb
payjp-0.0.9 test/payjp/token_test.rb
payjp-0.0.8 test/payjp/token_test.rb
payjp-0.0.7 test/payjp/token_test.rb
payjp-0.0.6 test/payjp/token_test.rb
payjp-0.0.5 test/payjp/token_test.rb
payjp-0.0.4 test/payjp/token_test.rb
payjp-0.0.3 test/payjp/token_test.rb
payjp-0.0.2 test/payjp/token_test.rb