Commit 7d8ff5a

mo khan <mo@mokhan.ca>
2014-11-15 15:33:42
add a few more validation specs.
1 parent 75b765f
Changed files (1)
spec
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