Commit 7d8ff5a
Changed files (1)
spec
models
spec/models/user_spec.rb
@@ -23,6 +23,12 @@ describe User do
context "validations" do
subject { build(:user) }
+ context "when all fields are provided" do
+ it 'is valid' do
+ expect(subject).to be_valid
+ end
+ end
+
context "when the email is blank" do
it 'produces an error' do
subject.email = ''
@@ -45,5 +51,12 @@ describe User do
expect(subject.errors[:email]).to be_empty
end
end
+
+ context "when the password is missing" do
+ it 'produces an error' do
+ subject.password = nil
+ expect(subject).to_not be_valid
+ end
+ end
end
end