spec/csl/parser_spec.rb in csl-1.0.2 vs spec/csl/parser_spec.rb in csl-1.1.0
- old
+ new
@@ -1,9 +1,9 @@
require 'spec_helper'
module CSL
-
+
describe Parser do
describe '.instance' do
it 'returns the parser' do
Parser.instance.should be_instance_of(Parser)
@@ -11,11 +11,11 @@
end
Parser.engines.each_pair do |name, parser|
describe "when using the #{name} parser " do
before(:all) { Parser.instance.parser = parser }
-
+
describe '#parse' do
describe 'for <foo/>' do
let(:source) { '<foo/>' }
@@ -36,11 +36,11 @@
end
end
describe 'for <foo bar="x"/>' do
let(:source) { '<foo bar="x"/>' }
-
+
it 'returns a node with attributes' do
Parser.instance.parse(source).should have_attributes
end
it 'returns a node with attribute bar' do
@@ -52,41 +52,41 @@
end
end
describe 'for <foo>Foo Bar</foo>' do
let(:source) { '<foo>Foo Bar</foo>' }
-
+
it 'returns text node' do
Parser.instance.parse(source).should be_textnode
end
end
it 'returns a regular node for <x>\n <y/></x>' do
Parser.instance.parse("<x>\n <y/></x>").should_not be_textnode
end
-
- describe 'xml comments' do
- it 'ignores comment-only documents' do
- Parser.instance.parse("<!--x></x-->").should be_nil
- end
- it 'ignores comments in normal nodes' do
- Parser.instance.parse("<x><!-- comment --></x>").should_not have_children
- end
+ describe 'xml comments' do
+ it 'ignores comment-only documents' do
+ Parser.instance.parse("<!--x></x-->").should be_nil
+ end
- it 'ignores comments in text nodes' do
- node = Parser.instance.parse("<x>foo<!-- comment --></x>")
- node.should be_textnode
- node.should_not have_children
- node.text.should == 'foo'
- end
-
- end
-
+ it 'ignores comments in normal nodes' do
+ Parser.instance.parse("<x><!-- comment --></x>").should_not have_children
+ end
+
+ it 'ignores comments in text nodes' do
+ node = Parser.instance.parse("<x>foo<!-- comment --></x>")
+ node.should be_textnode
+ node.should_not have_children
+ node.text.should == 'foo'
+ end
+
+ end
+
end
-
+
end
end
end
-
-end
\ No newline at end of file
+
+end