Permalink
Browse files

card validates presence of front

  • Loading branch information...
1 parent e00ca79 commit bd0105d76f3d18d7c668af6d51ae3f5dfeb2c24d @patrickdet patrickdet committed Apr 24, 2012
Showing with 3 additions and 0 deletions.
  1. +2 −0 app/models/card.rb
  2. +1 −0 spec/models/card_spec.rb
View
@@ -3,4 +3,6 @@ class Card < ActiveRecord::Base
belongs_to :user
attr_accessible :front, :back
+
+ validates :front, presence: true
end
View
@@ -7,6 +7,7 @@
it { should belong_to(:deck) }
it { should allow_mass_assignment_of :front }
it { should allow_mass_assignment_of :back }
+ it { should validate_presence_of :front }
context "fresh out of the factory" do
subject { FactoryGirl.create(:card) }

0 comments on commit bd0105d

Please sign in to comment.