Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add specs for %i{} and %I{}

  • Loading branch information...
commit c63d5fddaf2890807d7a5adfe2437d9bbd7ff276 1 parent 300a931
@LTe authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 spec/ruby/language/array_spec.rb
View
13 spec/ruby/language/array_spec.rb
@@ -54,6 +54,19 @@
%W(a\ b\tc).should == ["a ", "b\tc"]
%W(white\ \ \ \ \ space).should == ["white ", " ", " ", " space"]
end
+
+ ruby_version_is "2.0" do
+ it "%i() transforms unquoted barewords into an array of symbols" do
+ %i(a b c).should == [:a, :b, :c]
+ %i("foo).should == [:"\"foo"]
+ end
+
+ it "%I() transforms unquoted barewords into an array of symbols, supporting interpolation" do
+ x = 10
+ %I(a b#{x}).should == [:a, :b10]
+ %I("a#{x}).should == [:"\"a10"]
+ end
+ end
end
describe "The unpacking splat operator (*)" do
Please sign in to comment.
Something went wrong with that request. Please try again.