Sha256: fd07ad973b10b05b032fc8e298a61fc3442e72c0c95733121f1ad7c2f158aeb3

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require "spec_helper"
describe ActiveTriples::Configurable do
  before do
    class DummyConfigurable
      extend ActiveTriples::Configurable
    end
  end
  after do
    Object.send(:remove_const, "DummyConfigurable")
  end

  describe '#configure' do
    before do
      DummyConfigurable.configure base_uri: "http://example.org/base", type: RDF::RDFS.Class, rdf_label: RDF::DC.title
    end

    it 'should set a base uri' do
      expect(DummyConfigurable.base_uri).to eq "http://example.org/base"
    end

    it 'should set an rdf_label' do
      expect(DummyConfigurable.rdf_label).to eq RDF::DC.title
    end

    it 'should set a type' do
      expect(DummyConfigurable.type).to eq RDF::RDFS.Class
    end
  end

  describe '#rdf_type' do
    it "should set the type the old way" do
      expect(DummyConfigurable).to receive(:configure).with(type: RDF::RDFS.Class).and_call_original
      expect(Deprecation).to receive(:warn)
      DummyConfigurable.rdf_type(RDF::RDFS.Class)
      expect(DummyConfigurable.type).to eq RDF::RDFS.Class
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
active-triples-0.4.1 spec/active_triples/configurable_spec.rb
active-triples-0.6.1 spec/active_triples/configurable_spec.rb
active-triples-0.6.0 spec/active_triples/configurable_spec.rb
active-triples-0.5.0 spec/active_triples/configurable_spec.rb
active-triples-0.4.0 spec/active_triples/configurable_spec.rb
active-triples-0.3.1 spec/active_triples/configurable_spec.rb
active-triples-0.3.0 spec/active_triples/configurable_spec.rb