Sha256: b52d42fe616d4c9b30b5c91947f8ec6fd48d07c5272ab67875798f98a1905d5a

Contents?: true

Size: 952 Bytes

Versions: 2

Compression:

Stored size: 952 Bytes

Contents

require 'rspec'


describe 'OpenPayResource' do




  before(:all) do

    @merchant_id='mywvupjjs9xdnryxtplq'
    @private_key='sk_92b25d3baec149e6b428d81abfe37006'

    @openpay=OpenpayApi.new(@merchant_id,@private_key)
    @cards=@openpay.create(:cards)

  end


  describe '.hash2json' do


    it 'converts a ruby hash into a json string' do
      card_hash = FactoryGirl.build(:valid_card, holder_name: 'Juan')
      json=@cards.hash2json(card_hash)
      expect(json).to have_json_path('holder_name')
      expect(json).to have_json_path('expiration_year')
      expect(json).to have_json_path('bank_code')

    end


  end


  describe '.json2hash' do


    it 'converts json into a ruby hash' do
      card_hash = FactoryGirl.build(:valid_card, holder_name: 'Pepe')
      json=@cards.hash2json(card_hash)
      jash=@cards.json2hash(json)
      expect(jash).to be_a Hash
      expect(jash['holder_name']).to match 'Pepe'


    end

  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openpay-1.0.1 test/spec/openpayresource_spec.rb
openpay-0.9.8 test/spec/openpayresource_spec.rb