Skip to content

Instantly share code, notes, and snippets.

@dasch
Created January 13, 2010 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dasch/276170 to your computer and use it in GitHub Desktop.
Save dasch/276170 to your computer and use it in GitHub Desktop.
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