Sha256: f7d38dbd6438fedadb6cebac3145ae85a7d2012d8d0738f96228665e983abdaa

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

require 'spec_helper'

describe ForeignKeyValidation::Collector do

  let(:user) { User.create }
  let(:other_user) { User.create }

  describe ".new" do

    subject { ForeignKeyValidation::Collector }

    it "initializes new validator" do
      expect(subject.new).to be_instance_of ForeignKeyValidation::Collector
    end

  end

  describe "#check!" do

    it "returns true for known class" do
      expect(ForeignKeyValidation::Collector.new(klass: Issue).check!).to be true
    end

    it "raises error for class without relations" do
      expect{ForeignKeyValidation::Collector.new(klass: Dummy).check!}.to raise_error(ForeignKeyValidation::Errors::NoReleationFoundError)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreign_key_validation-1.1.1 spec/collector/base_spec.rb
foreign_key_validation-1.1.0 spec/collector/base_spec.rb