Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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