-
-
Save bcardarella/967720 to your computer and use it in GitHub Desktop.
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
require 'spec_helper' | |
describe User do | |
describe "Object Attributes" do | |
before(:each) { @obj = User.new } | |
specify { @obj.should respond_to(:first_name) } | |
specify { @obj.should respond_to(:last_name) } | |
specify { @obj.should respond_to(:login) } | |
end | |
describe "Associations" do | |
before(:each) { @obj = User.new } | |
specify { @obj.should respond_to(:addresses) } | |
specify { @obj.should respond_to(:phones) } | |
specify { @obj.should respond_to(:emails) } | |
specify { @obj.should respond_to(:roles) } | |
specify { @obj.should respond_to(:photos) } | |
specify { @obj.should respond_to(:do_avails) } | |
specify { @obj.should respond_to(:messages) } | |
specify { @obj.should respond_to(:distributions) } | |
end | |
describe "Validations" do | |
it { should have_valid(:first_name).when("Joe", "J x", "J.x") } | |
it { should_not have_valid(:first_name).when("", "J_x") } | |
it { should have_valid(:last_name).when("Smith") } | |
it { should_not have_valid(:last_name).when("") } | |
it { should have_valid(:login).when("joe.smith") } | |
it { should_not have_valid(:login).when("") } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment