Sha256: d9b5326f8f49edd072b63d6b37a8443941d1514e2b24a1641911f622cb9b3769
Contents?: true
Size: 1.48 KB
Versions: 3
Compression:
Stored size: 1.48 KB
Contents
require 'rdf/spec' share_as :RDF_Format do include RDF::Spec::Matchers before(:each) do raise raise '+@format_class+ must be defined in a before(:each) block' unless instance_variable_get('@format_class') end describe ".for" do RDF::Format.file_extensions.each do |ext, formats| it "detects #{formats.first} using file path foo.#{ext}" do RDF::Format.for("foo.#{ext}").should == formats.first end it "detects #{formats.first} using file_name foo.#{ext}" do RDF::Format.for(:file_name => "foo.#{ext}").should == formats.first end it "detects #{formats.first} using file_extension #{ext}" do RDF::Format.for(:file_extension => ext).should == formats.first end end RDF::Format.content_types.each do |content_type, formats| it "detects #{formats.first} using content_type #{content_type}" do RDF::Format.for(:content_type => content_type).should == formats.first end end end describe ".reader" do it "returns a reader" do @format_class.each do |f| f.reader.should_not be_nil end end end describe ".writer" do ## # May not return a writer, only does if one is defined by the format it "returns a writer" do @format_class.each do |f| format_namespace = f.name.split('::')[0..-2].inject(Kernel) {|base, const| base.const_get(const)} f.writer.should_not be_nil if format_namespace.const_defined?(:Writer) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rdf-spec-0.3.8 | lib/rdf/spec/format.rb |
rdf-spec-0.3.7 | lib/rdf/spec/format.rb |
rdf-spec-0.3.5.1 | lib/rdf/spec/format.rb |