Skip to content

Commit

Permalink
Added two rspec tests for type="array" scenarios.
Browse files Browse the repository at this point in the history
  • Loading branch information
fisherwebdev committed Dec 30, 2011
1 parent bbbe07b commit 476adf6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/parser_shared_example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,34 @@
MultiXml.parse(@xml)['users'].should == ["Erik Michaels-Ober", "Wynn Netherland"]
end
end

context "with an attribute type=\"array\" in addtion to other attributes" do
before do
@xml = '<users type="array" foo="bar"><user>Erik Michaels-Ober</user><user>Wynn Netherland</user></users>'
end

it "should return an Array" do
MultiXml.parse(@xml)['users'].should be_a(Array)
end

it "should return the correct array" do
MultiXml.parse(@xml)['users'].should == ["Erik Michaels-Ober", "Wynn Netherland"]
end
end

context "with an attribute type=\"array\" containing only one item" do
before do
@xml = '<users type="array"><user>Erik Michaels-Ober</user></users>'
end

it "should return an Array" do
MultiXml.parse(@xml)['users'].should be_a(Array)
end

it "should return the correct array" do
MultiXml.parse(@xml)['users'].should == ["Erik Michaels-Ober"]
end
end

%w(integer boolean date datetime yaml file).each do |type|
context "with an empty attribute type=\"#{type}\"" do
Expand Down

0 comments on commit 476adf6

Please sign in to comment.