Skip to content

Instantly share code, notes, and snippets.

@jaysonrowe
Created September 7, 2011 21:32
Show Gist options
  • Save jaysonrowe/1201812 to your computer and use it in GitHub Desktop.
Save jaysonrowe/1201812 to your computer and use it in GitHub Desktop.
describe User do
before(:each) do
@attr = { :name => "Example User", :email => "user@example.com" }
end
it "should create a new instance given valid attributes" do
User.create!(@attr)
end
it "should require a name" do
no_name_user = User.new(@attr.merge(:name => ""))
no_name_user.should_not be_valid
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment