Permalink
Browse files

Merge pull request #1711 from r-stu31/spec_splat_orarray

Add a test case for a splat of 'obj || []'.
  • Loading branch information...
2 parents 9153ef6 + c0ce4de commit 15eb22feb1b90403465fef0fa822eea31a27cbe1 @arthurschreiber arthurschreiber committed May 9, 2012
Showing with 5 additions and 0 deletions.
  1. +4 −0 spec/ruby/language/splat_spec.rb
  2. +1 −0 spec/tags/19/ruby/language/splat_tags.txt
View
4 spec/ruby/language/splat_spec.rb
@@ -52,6 +52,10 @@
a = *1; a.should == [1]
end
+ it "assigns the splatted object contained into an array when the splatted object is a result of 'obj || []'" do
+ a = *(1 || []); a.should == [1]
+ end
+
it "assigns the returned value of to_a when the splatted object responds to to_a" do
o = mock(Object)
o.should_receive(:to_a).once.and_return(["foo"])
View
1 spec/tags/19/ruby/language/splat_tags.txt
@@ -0,0 +1 @@
+fails:Splat operator used to assign a splatted object to an object assigns the splatted object contained into an array when the splatted object is a result of 'obj || []'

0 comments on commit 15eb22f

Please sign in to comment.