Created
January 18, 2011 09:36
-
-
Save MarkPochert/784203 to your computer and use it in GitHub Desktop.
DRY?
This file contains 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
context "correct format" do | |
it "should be invalid with an invalid email address" do | |
invalid_email_addresses.each do |invalid| | |
@user.email = invalid | |
@user.should_not be_valid | |
end | |
end | |
it "should be valid with an valid email address" do | |
valid_email_addresses.each do |valid| | |
@user.email = valid | |
@user.should be_valid | |
end | |
end | |
it "should be invalid with an invalid username" do | |
invalid_usernames.each do |invalid| | |
@user.username = invalid | |
@user.should_not be_valid | |
end | |
end | |
it "should be valid with an valid username" do | |
valid_usernames.each do |valid| | |
@user.username = valid | |
@user.should be_valid | |
end | |
end | |
it "should be invalid with an invalid password" do | |
invalid_passwords.each do |invalid| | |
@user.password = invalid | |
@user.should_not be_valid | |
end | |
end | |
it "should be valid with an valid password" do | |
valid_passwords.each do |valid| | |
@user.password = valid | |
@user.should be_valid | |
end | |
end | |
it "should be invalid with an invalid phonenumber" do | |
invalid_phonenumbers.each do |invalid| | |
@user.phone_number = invalid | |
@user.should_not be_valid | |
end | |
end | |
it "should be valid with an valid phonenumber" do | |
valid_phonenumbers.each do |valid| | |
@user.phone_number = valid | |
@user.should be_valid | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment