I am executing three different cases for my login method, on successful login i receive the below auth
token
{"auth":"eyJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6IkRpZGllci5EZXNjaGFtcHNAbm93aGVyZS5jb20iLCJoYXNoIjoiMFIzM3lnckhJNTNjNDg1NDA4YzliZWUzZDEyM2UwZTQwY2I3OTc3YWEiLCJuYW1lIjoiRGlkaWVyIiwidXNlcmlkIjoyLCJhY2NvdW50aWQiOjB9.884v-blMRHE-VgYOvuJIOwZHNhuaKuhprYO9xU6IYtE"}
How do i check whether my user object has the auth key
or not in rspec
to pass the test.
require 'spec_helper'
describe User do
context "when signing in" do
it "should not login with invalid code" do
user = User.login(email: email, password: password, confirmpassword: password, code: 10000);
end
it "should not login with no code" do
user = User.login(email: email, password: password, confirmpassword: password, code: "");
end
it "should login with valid code" do
user = User.login(email: email, password: password, confirmpassword: password, code: 0);
end
end
end