Sha256: 5cc872dfc76b3678cf269a8ca82f7f9bd9dfbad8d3f508e9f5be8db0e43715e1

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 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::Validation).to receive(:inject_validations).with(User, {})
      end

      it { User.validates_strict_columns }
    end

    context 'with options' do
      before do
        expect(ActiveRecord::MySQL::Strict::Validation).to receive(:inject_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.1 spec/activerecord_mysql_strict_spec.rb