Sha256: beca8a29eddddfaf13990d17c1871def9d71fe7e975ecfc0b3a8fdd37d6e3c51

Contents?: true

Size: 740 Bytes

Versions: 89

Compression:

Stored size: 740 Bytes

Contents

require 'test_helper'

class CassandraObject::ValidationsTest < CassandraObject::TestCase
  test 'create!' do
    begin
      Issue.validates(:description, :presence => true)

      Issue.create!(:description => 'lol')

      assert_raise(CassandraObject::RecordInvalid) { Issue.create!(:description => '') }
    ensure
      Issue.reset_callbacks(:validate)
    end
  end

  test 'validates :on' do
    begin
      Issue.validates(:description, :presence => true, :on => :create)
      issue = Issue.create!(:description => 'lol')
      issue.update_attributes! :description => nil
      assert_raise(CassandraObject::RecordInvalid) { Issue.create!(:description => '') }
    ensure
      Issue.reset_callbacks(:validate)
    end
  end
end

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
sessionm-cassandra_object-4.0.32 test/validations_test.rb
sessionm-cassandra_object-4.0.31 test/validations_test.rb
sessionm-cassandra_object-4.0.30 test/validations_test.rb
sessionm-cassandra_object-4.0.29 test/validations_test.rb
sessionm-cassandra_object-4.0.28 test/validations_test.rb
sessionm-cassandra_object-4.0.27 test/validations_test.rb
sessionm-cassandra_object-4.0.26 test/validations_test.rb
sessionm-cassandra_object-4.0.25 test/validations_test.rb
sessionm-cassandra_object-4.0.24 test/validations_test.rb
sessionm-cassandra_object-4.0.23 test/validations_test.rb
sessionm-cassandra_object-4.0.22 test/validations_test.rb
sessionm-cassandra_object-4.0.21 test/validations_test.rb
sessionm-cassandra_object-4.0.20 test/validations_test.rb
sessionm-cassandra_object-2.7.5 test/validations_test.rb
sessionm-cassandra_object-2.7.4 test/validations_test.rb
sessionm-cassandra_object-4.0.18 test/validations_test.rb
sessionm-cassandra_object-4.0.17 test/validations_test.rb
sessionm-cassandra_object-4.0.16 test/validations_test.rb
sessionm-cassandra_object-4.0.15 test/validations_test.rb
sessionm-cassandra_object-4.0.14 test/validations_test.rb