diff --git a/language/fixtures/squiggly_heredoc.rb b/language/fixtures/squiggly_heredoc.rb new file mode 100644 index 0000000000..a265d0f07f --- /dev/null +++ b/language/fixtures/squiggly_heredoc.rb @@ -0,0 +1,8 @@ +module StringSpecs + def self.squiggly_message + <<~HEREDOC + character density, n.: + The number of very weird people in the office. + HEREDOC + end +end diff --git a/language/string_spec.rb b/language/string_spec.rb index 3662b46f3c..915de1af18 100644 --- a/language/string_spec.rb +++ b/language/string_spec.rb @@ -2,6 +2,10 @@ require File.expand_path('../../spec_helper', __FILE__) +ruby_version_is "2.3" do + require File.expand_path('../fixtures/squiggly_heredoc', __FILE__) +end + # TODO: rewrite these horrid specs. it "are..." seriously?! describe "Ruby character strings" do @@ -176,6 +180,12 @@ s.should == ' foo bar#{@ip}' + "\n" end + ruby_version_is "2.3" do + it "allows HEREDOC with <<~'identifier', allowing to indent identifier and content" do + StringSpecs.squiggly_message.should == "character density, n.:\n The number of very weird people in the office.\n" + end + end + it "calls #to_s when the object is not a String" do obj = mock('to_s') obj.stub!(:to_s).and_return('42')