Sha256: 32f9d374326fba97b6d3e9d1dd1741ed73227c8baa7875fd587d6c6579d66bcb
Contents?: true
Size: 816 Bytes
Versions: 34
Compression:
Stored size: 816 Bytes
Contents
require 'rails_helper' module PandaPal RSpec.describe ApiCall, type: :model do let!(:subject) { ApiCall.create!(logic: '"#{p[:foo]}_bar"') } let!(:jwt) { subject.jwt_token } describe ".from_jwt" do it "finds an ApiCall from a JWT" do expect(ApiCall.from_jwt(jwt)).to eq subject end it "fails if the JWT is invalid" do expect{ ApiCall.from_jwt("really.bad.jwt") }.to raise_error(JWT::DecodeError) end end describe "#call" do it "calls the function with parameters" do expect(subject.call(foo: 'FOO')).to eq 'FOO_bar' end end describe "#call_url" do it "generates a URL with the expected placholders" do expect(subject.call_url).to eq "/panda_pal/call_logic?foo=TODO&token=#{jwt}" end end end end
Version data entries
34 entries across 34 versions & 1 rubygems