Sha256: 66153c5a614064b6c221ac259ff85a4b3477638bf39608ca09ec930dba7db348

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe ActiveTriples::PropertyBuilder do
  subject         { described_class.new(name, options) }
  let(:name)      { :moomin }
  let(:predicate) { :predicate_uri }
  let(:options)   { { predicate: predicate } }

  it { is_expected.to have_attributes(name:    name) }
  it { is_expected.to have_attributes(options: options) }

  describe '#build' do
    it 'gives a config for name' do
      expect(subject.build)
        .to have_attributes(term: name, predicate: predicate)
    end
    
    it 'yields an IndexObject' do
      expect { |b| subject.build(&b) }.to yield_control
    end
  end

  describe '.create_builder' do
    it 'raises when property name is not a symbol' do
      expect { described_class.create_builder('name', options) }
        .to raise_error ArgumentError
    end

    it 'raises when predicate is invalid' do
      options[:predicate] = Time.now
      expect { described_class.create_builder(name, options) }
        .to raise_error ArgumentError
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
active-triples-1.2.0 spec/active_triples/property_builder_spec.rb
active-triples-1.1.1 spec/active_triples/property_builder_spec.rb
active-triples-1.1.0 spec/active_triples/property_builder_spec.rb
active-triples-1.0.0 spec/active_triples/property_builder_spec.rb
active-triples-1.0.0.rc1 spec/active_triples/property_builder_spec.rb
active-triples-0.11.0 spec/active_triples/property_builder_spec.rb
active-triples-0.10.2 spec/active_triples/property_builder_spec.rb
active-triples-0.10.1 spec/active_triples/property_builder_spec.rb
active-triples-0.10.0 spec/active_triples/property_builder_spec.rb
active-triples-0.9.0 spec/active_triples/property_builder_spec.rb
active-triples-0.8.3 spec/active_triples/property_builder_spec.rb
active-triples-0.8.2 spec/active_triples/property_builder_spec.rb