Created
January 13, 2010 13:10
-
-
Save dasch/276170 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
require 'test_helper' | |
context "The Hallway model" do | |
setup { Hallway } | |
teardown { Hallway.delete_all } | |
hookup { create_hallway } | |
asserts(:count).equals(1) | |
asserts("adding duplicate") { create_hallway }.raises(ActiveRecord::RecordInvalid) | |
def create_hallway(options = {}) | |
options = options.merge(:building => "ny", :floor => 4) | |
Hallway.create!(options) | |
end | |
end | |
context "A Hallway with valid attributes" do | |
setup { Hallway.new :building => "ny", :floor => 4 } | |
asserts(:building).equals("ny") | |
asserts(:floor).equals(4) | |
asserts(:to_s).equals("ny4") | |
asserts(:valid?) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment