Sha256: f9219dae51b88ffe64d558103fbe888133f9873c525a9ad59fa4b40e286c87c7

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

require 'spec_helper'

describe ActiveRecord::MySQL::Strict do
  describe :validates_strict_columns do
    before do
      spawn_model 'User'
      run_migration do
        create_table(:users, force: true) { |t| t.string :name }
      end
    end

    context 'without options' do
      before do
        expect(ActiveRecord::MySQL::Strict::Validations).to receive(:define_mysql_strict_validations).with(User, {})
      end

      it { User.validates_strict_columns }
    end

    context 'with options' do
      before do
        expect(ActiveRecord::MySQL::Strict::Validations).to receive(:define_mysql_strict_validations).with(User, { except: [:bar], only: [:foo] })
      end

      it { User.validates_strict_columns except: [:bar], only: [:foo] }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord_mysql_strict-0.2 spec/activerecord_mysql_strict_spec.rb