Created
December 21, 2012 22:06
-
-
Save terabyte/4356189 to your computer and use it in GitHub Desktop.
how do you test something raises an error while also testing activerecord object classes?
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' | |
class EventTest < ActiveSupport::TestCase | |
test "event requires a username and a timestamp" do | |
e1 = Event.new | |
e1.id = 1 | |
e1.username = nil | |
e1.timestamp = Time.now | |
e1.description = "some description" | |
lambda { e1.save }.should_throw Error | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment