Created
August 24, 2011 19:21
-
-
Save jeffreyiacono/1168937 to your computer and use it in GitHub Desktop.
A sample user spec for Fernando / Dallas.rb
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
describe User do | |
it { should validate_presence_of :email } | |
describe :full_name do | |
subject { User.new(:email => "[email protected]") } | |
context "when first and last name are present" do | |
before { subject.first_name, subject.last_name = "Jeff", "Iacono" } | |
its(:full_name) { should eq("Jeff Iacono") } | |
end | |
context "when only first name is present" do | |
before { subject.first_name = "Jeff" } | |
its(:full_name) { should eq("Jeff") } | |
end | |
context "when only last name is present" do | |
before { subject.last_name = "Iacono" } | |
its(:full_name) { should eq("Iacono") } | |
end | |
context "when first and last are not present" do | |
its(:full_name) { should eq("[email protected]") } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment