Skip to content

Instantly share code, notes, and snippets.

@bhuga
Created April 7, 2010 03:16
Show Gist options
  • Save bhuga/358469 to your computer and use it in GitHub Desktop.
Save bhuga/358469 to your computer and use it in GitHub Desktop.
RSpec:
should support #predicates
200 OK | text/plain 1070 bytes
200 OK | text/plain 1070 bytes
200 OK | text/plain 1070 bytes
200 OK | text/plain 1070 bytes
200 OK | text/plain 1070 bytes
200 OK | text/plain 1070 bytes
200 OK | text/plain 1070 bytes
200 OK | text/plain 1070 bytes
200 OK | text/plain 1070 bytes
200 OK | text/plain 1070 bytes
With these matchers:
it "should support #predicates" do
@enumerable.respond_to?(:predicates).should be_true
@enumerable.predicates.should be_instance_of(Array)
@enumerable.predicates.each { |value| value.should be_a_uri }
end
But in IRB:
?> r = RDF::Talis::Repository.new 'bhuga-dev1'
=> #<RDF::Talis::Repository:0x12a9260 @settings={}, @store="bhuga-dev1">
>> r.respond_to? :predicates
=> true
>> r.predicates.is_a? Array
200 OK | text/plain 1070 bytes
=> true
>> r.predicates.each do |pred| puts pred.inspect end
200 OK | text/plain 1070 bytes
#<RDF::URI:0x910f32(http://www.w3.org/1999/02/22-rdf-syntax-ns#type)>
#<RDF::URI:0x90e41c(http://xmlns.com/foaf/0.1/account)>
#<RDF::URI:0x90cf4a(http://xmlns.com/foaf/0.1/nick)>
#<RDF::URI:0x90b69a(http://xmlns.com/foaf/0.1/name)>
#<RDF::URI:0x90a9d4(http://xmlns.com/foaf/0.1/mbox)>
#<RDF::URI:0x908a8a(http://xmlns.com/foaf/0.1/homepage)>
#<RDF::URI:0x90827e(http://xmlns.com/foaf/0.1/knows)>
#<RDF::URI:0x900a56(http://xmlns.com/foaf/0.1/maker)>
#<RDF::URI:0x8f8c20(http://xmlns.com/foaf/0.1/primaryTopic)>
=> [#<RDF::URI:0x910f32(http://www.w3.org/1999/02/22-rdf-syntax-ns#type)>, #<RDF::URI:0x90e41c(http://xmlns.com/foaf/0.1/account)>, #<RDF::URI:0x90cf4a(http://xmlns.com/foaf/0.1/nick)>, #<RDF::URI:0x90b69a(http://xmlns.com/foaf/0.1/name)>, #<RDF::URI:0x90a9d4(http://xmlns.com/foaf/0.1/mbox)>, #<RDF::URI:0x908a8a(http://xmlns.com/foaf/0.1/homepage)>, #<RDF::URI:0x90827e(http://xmlns.com/foaf/0.1/knows)>, #<RDF::URI:0x900a56(http://xmlns.com/foaf/0.1/maker)>, #<RDF::URI:0x8f8c20(http://xmlns.com/foaf/0.1/primaryTopic)>]
Why is the repo loaded 10 times in rspec?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment