Sha256: 6e7e0aea1d10087615d6d2d56cb50a6327a573c59f241bcf886529c4ef63e1cc

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

module PlaidRails
  describe LinkController do
    routes { PlaidRails::Engine.routes }
   
    it "authenticate with public token" do
      xhr :post, :authenticate, public_token: 'test,wells,connected', name:'Wells Fargo', type: 'wells',
        owner_id: "1", owner_type: "User"
      expect(response).to be_success
      expect(response).to render_template('plaid_rails/link/authenticate')
    end
    
    it "can't authenticate with bad public token" do
      xhr :post, :authenticate, public_token: 'badtoken', name:'Wells Fargo', type: 'wells',
        owner_id: "1", owner_type: "User"
      expect(response).to_not be_success
      expect(response.status).to eq 500
      expect(response.body).to include "unauthorized product"
    end
    
    it "update with public token" do
      account = create(:account)
      xhr :post, :update, public_token: 'test,wells,connected', name:'Wells Fargo', type: 'wells',
        owner_id: "1", owner_type: "User"
      expect(response).to be_success
      expect(assigns(:accounts)).to_not be_nil
      expect(response).to render_template('plaid_rails/link/update')
    end
    it {
      should permit(:public_token, :type,:name,:owner_id,:owner_type).
        for(:authenticate, verb: :post, format: :js)}
    it {
      should permit(:access_token,:public_token, :type,:name,:owner_id,:owner_type).
        for(:update, verb: :post, format: :js)}

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plaid_rails-0.6.0 spec/controllers/plaid_rails/link_controller_spec.rb
plaid_rails-0.5.0 spec/controllers/plaid_rails/link_controller_spec.rb