Skip to content

Instantly share code, notes, and snippets.

@maxim
Created November 19, 2008 15:49
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 maxim/26546 to your computer and use it in GitHub Desktop.
Save maxim/26546 to your computer and use it in GitHub Desktop.
# The test
setup do
@asset = Asset.new({:kind => 'image',
:user_rights => 3,
:everyone_rights => 1,
:description => "nice dragon",
:object => File.new(File.expand_path(File.dirname(__FILE__) + '/asset_test/dragon.svg'))
})
end
should "be of correct kind" do
@asset.kind = "fluffyhorse"
assert_raises ActiveRecord::StatementInvalid do
@asset.save
end
end
# Expected result
# PASS - Database should catch that kind 'fluffyhorse' isn't allowed due to constraint.
# Actual result
# FAIL - <ActiveRecord::StatementInvalid> exception expected but none was thrown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment