Sha256: fe5fd1fa6e2d3a6a81dc0d63482b3815a1305870304cd1195265703b1c0eb9c8

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

require 'spec_helper'

describe ActiveRecord::MySQL::Strict::Validation::IntegerValidation do
  describe :apply do
    context 'for model without other validations' do
      let(:model) { strict_model 'User' }

      context 'with field with default limit' do
        before do
          run_migration do
            create_table(:users, force: true) { |t| t.integer :number }
          end
        end

        context 'with field value exceeding limit' do
          subject { model.new(number: 9999999999) }
          it { should_not be_valid }
        end

        context 'with field value not exceeding limit' do
          subject { model.new(number: 2147483647) }
          it { should be_valid }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord_mysql_strict-0.2.1 spec/activerecord_mysql_strict/validation/integer_validation_spec.rb