Sha256: b2b89e51d7d140683a66a662234472b55175f2b68ef2d77d3a5f34fd4db97ef6

Contents?: true

Size: 970 Bytes

Versions: 7

Compression:

Stored size: 970 Bytes

Contents

require_relative '../spec_helper'


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

7 entries across 7 versions & 1 rubygems

Version Path
openpay-1.0.8 test/spec/openpayresource_spec.rb
openpay-1.0.7 test/spec/openpayresource_spec.rb
openpay-1.0.6 test/spec/openpayresource_spec.rb
openpay-1.0.5 test/spec/openpayresource_spec.rb
openpay-1.0.4 test/spec/openpayresource_spec.rb
openpay-1.0.3 test/spec/openpayresource_spec.rb
openpay-1.0.2 test/spec/openpayresource_spec.rb