Skip to content

Commit

Permalink
Fix bad NQuads test file.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Mar 22, 2013
1 parent 5b42115 commit 309ae4b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
4 changes: 2 additions & 2 deletions spec/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def capture_stdout
end

TEST_FILES = {
:nt => File.expand_path(File.join(File.dirname(__FILE__), 'data', 'test.nt')),
:nq => File.expand_path(File.join(File.dirname(__FILE__), 'data', 'test.nq')),
:nt => fixture_path('test.nt'),
:nq => fixture_path('test.nq'),
}

describe "#serialize" do
Expand Down
2 changes: 1 addition & 1 deletion spec/data/test.nq
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
_:bnode1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://example.org/alice/foaf.rdf> .
_:bnode1 <http://xmlns.com/foaf/0.1/name> "Bob" <http://example.org/alice/foaf.rdf> .
_:bnode1 <http://xmlns.com/foaf/0.1/homepage> <http://example.org/bob/> <http://example.org/alice/foaf.rdf> .
_:bnode1 <http://www.w3. org/2000/01/rdf-schema#seeAlso> <http://example.org/bob/foaf.rdf> <http://example.org/alice/foaf.rdf> .
_:bnode1 <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://example.org/bob/foaf.rdf> <http://example.org/alice/foaf.rdf> .

<http://example.org/bob/foaf.rdf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://example.org/bob/foaf.rdf> .
<http://example.org/bob/foaf.rdf#me> <http://xmlns.com/foaf/0.1/name> "Bob" <http://example.org/bob/foaf.rdf> .
Expand Down
20 changes: 20 additions & 0 deletions spec/nquads_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
end

describe RDF::NQuads::Reader do
let(:testfile) {fixture_path('test.nq')}

before(:each) do
@reader_class = RDF::NQuads::Reader
@reader = RDF::NQuads::Reader.new
Expand All @@ -107,6 +109,20 @@
end
end

context "when created" do
it "should accept files" do
lambda { @reader_class.new(File.open(testfile)) }.should_not raise_error
end

it "should accept IO streams" do
lambda { @reader_class.new(StringIO.new('')) }.should_not raise_error
end

it "should accept strings" do
lambda { @reader_class.new('') }.should_not raise_error
end
end

context "#initialize" do
before :all do
@testfile = fixture_path('test.nt')
Expand Down Expand Up @@ -161,6 +177,10 @@
end
end
end

it "should parse W3C's test data" do
@reader_class.new(File.open(testfile)).to_a.size.should == 10
end
end

describe RDF::NQuads::Writer do
Expand Down
8 changes: 3 additions & 5 deletions spec/ntriples_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@
end

describe RDF::NTriples do
before :all do
@testfile = fixture_path('test.nt')
end
let(:testfile) {fixture_path('test.nt')}

before :each do
@reader = RDF::NTriples::Reader
Expand All @@ -156,7 +154,7 @@

context "when created" do
it "should accept files" do
lambda { @reader.new(File.open(@testfile)) }.should_not raise_error
lambda { @reader.new(File.open(testfile)) }.should_not raise_error
end

it "should accept IO streams" do
Expand Down Expand Up @@ -346,7 +344,7 @@
end

it "should parse W3C's test data" do
@reader.new(File.open(@testfile)).to_a.size.should == 30
@reader.new(File.open(testfile)).to_a.size.should == 30
end

it "should parse terms" do
Expand Down

0 comments on commit 309ae4b

Please sign in to comment.