Sha256: 9538b06e9f99ff65dd0c0d85fb504b497eb400335212f4fa92f329ac6e5438bf

Contents?: true

Size: 995 Bytes

Versions: 3

Compression:

Stored size: 995 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_id.should be_present
    response.token_id.should == response.data[:token_id]
    response.inspect.should =~ /#<Veritrans::SnapResult:\d+ \^\^ status: 200 time: \d+ms \^\^ data: \{token_id: "[\da-f\-]+"\}>/
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
veritrans-2.1.2 spec/veritrans_snap_spec.rb
veritrans-2.1.1 spec/veritrans_snap_spec.rb
veritrans-2.1.0 spec/veritrans_snap_spec.rb