Sha256: a63b1d336b3a8aaefbefff85f9eb1ff9225aff0e9716691e662783e18e36c309

Contents?: true

Size: 1.99 KB

Versions: 1

Compression:

Stored size: 1.99 KB

Contents

require_relative 'spec_helper'

describe NmiDirectPost::Base do
  def a_query
    NmiDirectPost::CustomerVault.find_by_customer_vault_id(a_cc_customer_vault_id)
  end
  before(:each) do
    NmiDirectPost::Base.establish_connection(nil, nil)
    NmiDirectPost::CustomerVault.establish_connection(nil, nil)
  end
  let(:credentials) { TestCredentials::INSTANCE }
  let(:a_cc_customer_vault_id) { credentials.cc_customer }
  it "should raise exception when username is an empty string" do
    NmiDirectPost::Base.establish_connection('', credentials.nmi_password)
    expect{a_query}.to raise_error(StandardError, "Please set a username by calling NmiDirectPost::Base.establish_connection(ENV['NMI_USERNAME'], ENV['NMI_PASSWORD'])")
  end
  it "should raise exception when password is an empty string" do
    NmiDirectPost::Base.establish_connection(credentials.nmi_username, nil)
    expect{a_query}.to raise_error(StandardError, "Please set a username by calling NmiDirectPost::Base.establish_connection(ENV['NMI_USERNAME'], ENV['NMI_PASSWORD'])")
  end
  it "should raise exception when username is nil" do
    NmiDirectPost::Base.establish_connection('', credentials.nmi_password)
    expect{a_query}.to raise_error(StandardError, "Please set a username by calling NmiDirectPost::Base.establish_connection(ENV['NMI_USERNAME'], ENV['NMI_PASSWORD'])")
  end
  it "should raise exception when password is nil" do
    NmiDirectPost::Base.establish_connection(credentials.nmi_username, nil)
    expect{a_query}.to raise_error(StandardError, "Please set a username by calling NmiDirectPost::Base.establish_connection(ENV['NMI_USERNAME'], ENV['NMI_PASSWORD'])")
  end
  it "should find parent connection" do
    NmiDirectPost::Base.establish_connection(credentials.nmi_username, credentials.nmi_password)
    expect{a_query}.to_not raise_error
  end
  it "should find parent connection" do
    NmiDirectPost::CustomerVault.establish_connection(credentials.nmi_username, credentials.nmi_password)
    expect{a_query}.to_not raise_error
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nmi_direct_post-0.2.0 spec/base_spec.rb