Created
January 26, 2011 20:33
-
-
Save hosh/797396 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
#http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/ | |
describe User do | |
subject { user } | |
let(:user) { User.new } | |
context "when name empty" do | |
it { should_not be_valid } | |
specify { user.save.should be_false } | |
end | |
context "when name not empty" do | |
let(:user) { User.new(:name => 'Sam') } | |
it { should be_valid } | |
specify { user.save.should be_true } | |
end | |
describe :present do | |
subject { user.present } | |
context "when user is a W" do | |
let(:user) { User.new(:gender => 'W') } | |
it { should be_a Flower } | |
end | |
context "when user is a M" do | |
let(:user) { User.new(:gender => 'M') } | |
it { should be_an IMac } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment