Sha256: e508e47a510949dd16f3b815ae136d448e6aaff616706e422903ce8b06aef820

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 Bytes

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" 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

1 entries across 1 versions & 1 rubygems

Version Path
bloom_remit-0.1.0 spec/requests/api/v1/txns_spec.rb