Sha256: d6f6ff2f2f3f6d43e65a9307d86b289f2520a05ed62d98d112d18cc0f70eed83

Contents?: true

Size: 792 Bytes

Versions: 5

Compression:

Stored size: 792 Bytes

Contents

require 'spec_helper'

describe ActiveTriples::Resource do

  subject { MyResource.new }

  before(:all) do
    class MyResource < ActiveTriples::Resource
      property :title, predicate: ::RDF::DC.title

      validates_presence_of :title
    end
  end

  after(:all) do
    Object.send(:remove_const, :MyResource)
  end

  describe "validation" do
    it "should have a presence validator on the class" do
      expect(MyResource.validators.first).to be_a(ActiveModel::Validations::PresenceValidator)
    end
    it "should have validation callbacks" do
      expect(MyResource._validate_callbacks).to be_present
    end
    it "should run the validations" do
      expect(subject).to receive(:run_validations!)
      subject.valid?
    end
    it { is_expected.to be_invalid }
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active-triples-0.7.6 spec/active_triples/validations_spec.rb
active-triples-0.7.5 spec/active_triples/validations_spec.rb
active-triples-0.7.4 spec/active_triples/validations_spec.rb
active-triples-0.7.3 spec/active_triples/validations_spec.rb
active-triples-0.7.2 spec/active_triples/validations_spec.rb