Sha256: 2bad385201d286772368e20b8e48664c2c43c52ed1f25909766caaf519e24be7
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
require 'rails_helper' RSpec.describe "api/v1/txns" do describe "#update" do let(:user) { create(:bloom_remit_dummy_user) } let(:txn) do create(:bloom_remit_txn, secret: SecureRandom.uuid, sender: user) end let(:headers) do { "ACCEPT" => "application/json", "CONTENT_TYPE" => "application/json", } end it "updates the status of the txn via POST" do post( BloomRemit::Engine.routes.url_helpers.api_v1_txn_url(txn), { secret: "fake", status: "doesn't matter", }.to_json, headers ) puts response.body expect(response.status).to be 404 post( BloomRemit::Engine.routes.url_helpers.api_v1_txn_url(txn), { secret: txn.secret, status: "paid", }.to_json, headers ) expect(response).to be_success expect(txn.reload).to be_paid end it "updates the status of the txn via PATCH" do patch( BloomRemit::Engine.routes.url_helpers.api_v1_txn_url(txn), { secret: "fake", status: "doesn't matter", }.to_json, headers ) expect(response.status).to be 404 patch( BloomRemit::Engine.routes.url_helpers.api_v1_txn_url(txn), { secret: txn.secret, status: "paid", }.to_json, headers ) expect(response).to be_success expect(txn.reload).to be_paid end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bloom_remit-0.2.1 | spec/requests/api/v1/txns_spec.rb |
bloom_remit-0.2.0 | spec/requests/api/v1/txns_spec.rb |