Sha256: 95d26b759a5ccd085103154211571f501fad02008410f94ae80f46d3e23ddc0d

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

require_relative '../test_helper'

describe Ebanx::Command::CreateMerchantSettlementRequest do
  before do
    @params = {
      from_name: 'João da Silva',
      from_email: 'joao@mailinator.com',
      message: 'Olá'
    }
  end

  it "can't run without arguments" do
    lambda { ebanx.do_create_merchant_settlement_request }.must_raise ArgumentError
  end

  it "can't run with invalid from_email" do
    params = @params.clone
    params.delete(:from_name)
    params.delete(:message)

    params[:from_email] = '...'

    lambda { ebanx.do_create_merchant_settlement_request params }.must_raise ArgumentError
  end

  it "can't run with too long message" do
    params = @params.clone
    params.delete(:from_name)
    params.delete(:from_email)

    params[:message] = [*('A'..'Z')].sample(1025).join

    lambda { ebanx.do_create_merchant_settlement_request params }.must_raise ArgumentError
  end

  it 'performs a successful request' do
    response = ebanx.do_create_merchant_settlement_request @params
    response.http_code.must_equal 200
    response.response['status'].must_equal 'SUCCESS'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ebanx-1.3.5 test/ebanx/create_merchant_settlement_request_command_test.rb
ebanx-1.3.4 test/ebanx/create_merchant_settlement_request_command_test.rb
ebanx-1.3.3 test/ebanx/create_merchant_settlement_request_command_test.rb
ebanx-1.3.2 test/ebanx/create_merchant_settlement_request_command_test.rb