lib/generators/authentication/templates/spec/models/session_spec.rb.erb in orthodox-0.3.5 vs lib/generators/authentication/templates/spec/models/session_spec.rb.erb in orthodox-0.3.6
- old
+ new
@@ -1,45 +1,44 @@
require "rails_helper"
-# Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox)
-# (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
+# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
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