Sha256: 7e26e5bb65ef0025e4691ac9e9982440fc617d3ef2ab56a4677de2f8d5321a42

Contents?: true

Size: 968 Bytes

Versions: 2

Compression:

Stored size: 968 Bytes

Contents

require (File.expand_path('../../../spec_helper', __FILE__))
# For Ruby > 1.9.3, use this instead of require
# require_relative '../../spec_helper'

describe Gestpay::CustomInfo do
  
  before do 
    @object = Object.new
    @object.extend Gestpay::CustomInfo
  end  

  describe "#gestpay_encode" do 
    custom_hash= {'par1'=>'http://path.to/stuff', 'par2'=> 123}
    encoded_string= "par1=687474703a2f2f706174682e746f2f7374756666*P1*par2=313233"
    it "encodes custom info values in base(16) notation" do 
      @object.gestpay_encode(custom_hash).should eq encoded_string
    end
  end

  describe "#gestpay_decode" do 
    custom_hash= {'par1'=>'http://path.to/stuff', 'par2'=> 123.to_s} #numbers will be returned as strings anyway
    encoded_string= "par1=687474703a2f2f706174682e746f2f7374756666*P1*par2=313233"
    it "decodes custom info values in base(16) notation" do 
      @object.gestpay_decode(encoded_string).should eq custom_hash
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gestpay-0.1.0 spec/lib/gestpay/custom_info_spec.rb
gestpay-0.0.4 spec/lib/gestpay/custom_info_spec.rb