Sha256: 4891c0acb5b949bc04fbdfe560e8fecf6c73669827569ac8d17b76045c45fb8f
Contents?: true
Size: 847 Bytes
Versions: 42
Compression:
Stored size: 847 Bytes
Contents
require 'rails_helper' module PandaPal RSpec.describe ApiCallController, type: :controller do let!(:api_call) { ApiCall.create!(logic: '"#{p[:foo]}_bar"') } def json_body JSON.parse(response.body) end describe "#call" do it "calls the function with parameters" do get :call, params: { token: api_call.jwt_token, foo: 'bar', use_route: 'panda_pal' } expect(response).to be_successful expect(json_body["status"]).to eq 'ok' expect(json_body["result"]).to eq 'bar_bar' end it "fails given a bad JWT" do get :call, params: { token: "bad.jwt.token", foo: 'bar', use_route: 'panda_pal' } expect(response).not_to be_successful expect(json_body["status"]).to eq 'error' expect(json_body["error"]).to eq 'Invalid JWT' end end end end
Version data entries
42 entries across 42 versions & 1 rubygems