Sha256: 1d8988df1951f4a489b2c76c90bff7da6950d958e4c89430cf6936dcbeeec053

Contents?: true

Size: 970 Bytes

Versions: 3

Compression:

Stored size: 970 Bytes

Contents

require 'spec_helper'

describe Nullalign::Introspectors::ValidatesPresenceOf do

  describe "finding missing nonnull constraints" do
    it "finds one" do
      indexes = subject.missing_nonnull_constraints(WrongAccount)

      expect(indexes).to eq([
        Nullalign::NonnullConstraint.new(
          WrongAccount,
          WrongAccount.table_name,
          "email"
        )
      ])
    end

    it "finds none when they're already in place" do
      expect(subject.missing_nonnull_constraints(CorrectAccount)).to be_empty
    end

    it 'finds none if there is an if condition' do
      expect(subject.missing_nonnull_constraints(WithIfAccount)).to be_empty
    end

    it 'finds none if there is an on condition' do
      expect(subject.missing_nonnull_constraints(WithOnAccount)).to be_empty
    end

    it 'finds none if there is an unless condition' do
      expect(subject.missing_nonnull_constraints(WithUnlessAccount)).to be_empty
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nullalign-0.0.4 spec/introspectors/validates_presence_of_spec.rb
nullalign-0.0.3 spec/introspectors/validates_presence_of_spec.rb
nullalign-0.0.2 spec/introspectors/validates_presence_of_spec.rb