spec/active_triples/properties_spec.rb in active-triples-0.3.1 vs spec/active_triples/properties_spec.rb in active-triples-0.4.0

- old
+ new

@@ -36,9 +36,25 @@ it "should keep strings which it can't constantize as strings" do DummyProperties.property :title, :predicate => RDF::DC.title, :class_name => "FakeClassName" expect(DummyProperties.reflect_on_property(:title)[:class_name]).to eq "FakeClassName" end + + it 'raises error when defining properties that are already methods' do + DummyProperties.send :define_method, :type, lambda { } + expect { DummyProperties.property :type, :predicate => RDF::DC.type }.to raise_error ArgumentError + end + + it 'raises error when defining properties already have method setters' do + DummyProperties.send :define_method, :type=, lambda { } + expect { DummyProperties.property :type, :predicate => RDF::DC.type }.to raise_error ArgumentError + end + + it 'allows resetting of properties' do + DummyProperties.property :title, :predicate => RDF::DC.alternative + DummyProperties.property :title, :predicate => RDF::DC.title + expect(DummyProperties.reflect_on_property(:title).predicate).to eq RDF::DC.title + end end describe '#config_for_term_or_uri' do before do DummyProperties.property :title, :predicate => RDF::DC.title