Sha256: ff9d1bd569521d6f6113ad9cdd557d8bad1a16e3556cb15c507726a8bc04d21e

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

require 'test_helper'

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

      Issue.create!(description: 'lol')

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

  test 'save!' do
    begin
      Issue.validates(:description, presence: true)

      Issue.new(description: 'lol').save!

      assert_raise(ActiveRecord::RecordInvalid) { Issue.new(description: '').save! }
    ensure
      Issue.reset_callbacks(:validate)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
superstore-3.0.0 test/unit/validations_test.rb
superstore-2.5.0 test/unit/validations_test.rb