Sha256: 9bd6a54b9d1e4e44acec0bf512b17a5804baacb61a9f7c7d403661d360eeb3cd

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

RSpec.describe PerfectMoneyMerchant::PaymentsController, :type => :controller do
	context 'POST success' do
		it 'with 200' do
			post :success
			expect(response).to have_http_status(200)
		end
	end

	context 'POST error' do
		it 'with 400' do
			post :error
			expect(response).to have_http_status(400)
		end
	end

	context 'POST status' do
		before(:example) do
			PerfectMoneyMerchant::Account.create!(
					secret_key: 'SFndfsdJNFjern2D123raFDF2'
			).tap do |account|
				account.units.create!(
						{
								currency: 'usd',
								code_number: 'U1234567'
						}
				)
			end
		end

		let (:sci_params) do
			{
					payee_account: 'U1234567',
					payer_account: 'U7654321',
					payment_amount: '100.0',
					payment_units: 'USD',
					payment_batch_num: '73550837',
					payment_id: 'okpZKCUM9sML99Qzx1t7e',
					timestampgmt: '1415801831',
					suggested_memo: 'The New Friends Payment',
					v2_hash: '634D048EB7583DE389AF550E519CBE4C',
					payment_purpose: 'test_task'
			}
		end

		it 'with 200 status code' do
			post :status, sci_params
			expect(response).to have_http_status(200)
		end

		it 'with 400 status code' do
			post :status, sci_params.tap { |hash| hash[:payment_amount] = '1.0' }
			expect(response).to have_http_status(400)
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
perfect_money_merchant-0.1.2 spec/controllers/perfect_money_merchant/payments_controller_spec.rb
perfect_money_merchant-0.1.1.alpha.1 spec/controllers/perfect_money_merchant/payments_controller_spec.rb
perfect_money_merchant-0.1.0.alpha.4 spec/controllers/perfect_money_merchant/payments_controller_spec.rb
perfect_money_merchant-0.1.0.alpha.3 spec/controllers/perfect_money_merchant/payments_controller_spec.rb