Sha256: 5350702ffff49c5684437496a5e8a636acca85f742f25fff57e1b02107183149
Contents?: true
Size: 1.13 KB
Versions: 6
Compression:
Stored size: 1.13 KB
Contents
require "rails_helper" # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox) # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved. RSpec.describe <%= class_name %>Session, type: :model do context "when credentials valid" do let(:<%= singular_name %>) { create(:<%= singular_name %>) } before do subject.email = <%= singular_name %>.email subject.password = <%= singular_name %>.password end it { is_expected.to be_valid } it "sets the <%= singular_name %> attribute to the matching record" do subject.valid? expect(subject.<%= singular_name %>).to eql(<%= singular_name %>) end end context "when credentials are invalid" do before do subject.email = Faker::Internet.safe_email subject.password = "wrong-password" end it { is_expected.not_to be_valid } it "sets the <%= singular_name %> attribute to nil" do expect(subject.<%= singular_name %>).to be_nil end it "has errors on base" do subject.valid? expect(subject.errors[:base]).to be_present end end end
Version data entries
6 entries across 6 versions & 1 rubygems