Sha256: c09ab56054d23466b788cacfe8b8b9448a7c7c36775c695a5dc8ef9b45c26968
Contents?: true
Size: 921 Bytes
Versions: 3
Compression:
Stored size: 921 Bytes
Contents
require File.expand_path('../../test_helper', __FILE__) class ClassValidationTest < MiniTest::Unit::TestCase def test_validates_presence_of_field h = Pigkeeper.new(:visited => nil) refute h.valid? refute h.save assert_equal ["can't be blank"], h.errors[:visited], h.visited = true assert h.save end def test_validates_presence_of h = Fauna::User.new(:email => email, :password => password) refute h.valid? refute h.save assert_equal ["can't be blank"], h.errors[:name] h.name = "Llyan" assert h.save end def test_fails_save! h = Pigkeeper.new(:visited => nil) assert_raises(Fauna::Invalid) { h.save! } end def test_validate_callback h = Pigkeeper.new(:visited => true, :pockets => 0) refute h.valid? refute h.save assert_equal ["must be full of piggy treats"], h.errors[:pockets] h.pockets = 1 assert h.save end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fauna-0.1.2 | test/model/validation_test.rb |
fauna-0.1.1 | test/model/validation_test.rb |
fauna-0.1 | test/model/validation_test.rb |