Skip to content

Instantly share code, notes, and snippets.

@frosty
Created March 24, 2010 07:58
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 frosty/342086 to your computer and use it in GitHub Desktop.
Save frosty/342086 to your computer and use it in GitHub Desktop.
require 'test_helper'
class FicTest < ActiveSupport::TestCase
fixtures :all
should_belong_to :user
should_belong_to :story
test "should validate presence of content" do
assert_raise (ActiveRecord::RecordInvalid) {
@fic = Fic.make(:content => nil)
}
end
test "should validate content length" do
assert_raise (ActiveRecord::RecordInvalid) {
@fic = Fic.make(:content => "Three words long",
:story => Story.make(:fic_length => 2,
:fic_length_enforce => true))
}
end
test "should save a valid fic" do
fic = Fic.make
assert fic.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment