spec/csl/parser_spec.rb in csl-1.2.0 vs spec/csl/parser_spec.rb in csl-1.2.1

- old
+ new

@@ -34,9 +34,29 @@ it 'returns a node with no children' do Parser.instance.parse(source).should_not have_children end end + describe 'for an empty name node' do + ['<name/>', '<name></name>', '<name> </name>'].each do |source| + it "returns a Style::Name for #{source.inspect} by default" do + Parser.instance.parse!(source).should be_a(Style::Name) + end + + it "returns a Style::Name for #{source.inspect} for Style scope" do + Parser.instance.parse!(source, Style).should be_a(Style::Name) + end + + it "returns a Node for #{source.inspect} for Locale scope" do + Parser.instance.parse!(source, Locale).should be_a(Node) + end + + it "returns an Info::Name for #{source.inspect} for Info scope" do + Parser.instance.parse!(source, Info).should be_a(Info::Name) + end + 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