-
-
Save radar/478257 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Validations | |
| validates_presence_of :email, :unless => Proc.new { |user| user.email.blank? } | |
| validates_presence_of :username, :unless => :registered_with_email? | |
| def registered_with_username? | |
| self.username.blank? | |
| end | |
| describe Account, "created" do | |
| describe "with username and password" do | |
| subject { Factory.build(:account, :email => nil) } | |
| it { should be_valid } | |
| end | |
| describe "with email and password" do | |
| subject { Factory.build(:account, :username => nil) } | |
| it { should be_valid } | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment