spec/parsing/fixtures_spec.rb in brianmario-yajl-ruby-0.5.2 vs spec/parsing/fixtures_spec.rb in brianmario-yajl-ruby-0.5.3
- old
+ new
@@ -6,22 +6,40 @@
passed, failed = Dir[fixtures].partition { |f| f['pass'] }
PASSED = passed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort
FAILED = failed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort
FAILED.each do |name, source|
- it "should not be able to parse #{File.basename(name)}" do
+ it "should not be able to parse #{File.basename(name)} as an IO" do
lambda {
parser = Yajl::Parser.new
parser.parse(StringIO.new(source))
}.should raise_error(Yajl::ParseError)
end
end
+ FAILED.each do |name, source|
+ it "should not be able to parse #{File.basename(name)} as a string" do
+ lambda {
+ parser = Yajl::Parser.new
+ parser.parse(source)
+ }.should raise_error(Yajl::ParseError)
+ end
+ end
+
PASSED.each do |name, source|
- it "should be able to parse #{File.basename(name)}" do
+ it "should be able to parse #{File.basename(name)} as an IO" do
lambda {
parser = Yajl::Parser.new
parser.parse(StringIO.new(source))
+ }.should_not raise_error(Yajl::ParseError)
+ end
+ end
+
+ PASSED.each do |name, source|
+ it "should be able to parse #{File.basename(name)} as a string" do
+ lambda {
+ parser = Yajl::Parser.new
+ parser.parse(source)
}.should_not raise_error(Yajl::ParseError)
end
end
end
\ No newline at end of file