Sha256: 83be1d4946dd53019506279019fdf8b22afb6eda5ca8559b6502d36ab5b11b8c
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe ActiveTriples::Property do subject { described_class.new(options) } let(:options) do { :name => :title, :predicate => RDF::DC.title, :class_name => "Test" } end it "should create accessors for each passed option" do expect(subject.name).to eq :title expect(subject.predicate).to eq RDF::DC.title expect(subject.class_name).to eq "Test" end describe "#to_h" do it "should not return the property's name" do expect(subject.to_h).to eq ( { :predicate => RDF::DC.title, :class_name => "Test" } ) end end it 'requires a :name' do expect { described_class.new({}) }.to raise_error(KeyError) end context '#cast' do it 'has a default of false' do expect(described_class.new(:name => :title).cast).to eq(false) end it 'allows for the default to be overridden' do expect(described_class.new(:name => :title, :cast => true).cast).to eq(true) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active-triples-0.8.3 | spec/active_triples/property_spec.rb |
active-triples-0.8.2 | spec/active_triples/property_spec.rb |