Sha256: 55866220305dbc5c252257c4ed64974f0d36b67ba92794d660ef5bdc231ea011

Contents?: true

Size: 984 Bytes

Versions: 2

Compression:

Stored size: 984 Bytes

Contents

describe Veritrans::Config do

  before do
    hide_const("Rails")
    Veritrans.logger = Logger.new("/dev/null")
    Veritrans.setup do
      config.load_config "./spec/configs/real_key.yml"
    end

    VCR.configure do |c|
      c.allow_http_connections_when_no_cassette = true
    end
  end

  after do
    VCR.configure do |c|
      c.allow_http_connections_when_no_cassette = false
    end
  end

  def generate_order_id
    "testing-#{rand.round(4)}-#{Time.now.to_i}"
  end

  it "should create widget token" do
    response = Veritrans.create_snap_token(
      transaction_details: {
        order_id: generate_order_id,
        gross_amount: 30_000
      }
    )

    response.should be_a(Veritrans::SnapResult)
    response.success?.should be_truthy
    response.token.should be_present
    response.token.should == response.data[:token]
    response.inspect.should =~ /#<Veritrans::SnapResult:\d+ \^\^ status: 201 time: \d+ms \^\^ data: \{token: "[\da-f\-]+"\}>/
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritrans-2.2.0 spec/veritrans_snap_spec.rb
veritrans-2.1.3 spec/veritrans_snap_spec.rb