Skip to content

Commit

Permalink
tests squiggly heredoc
Browse files Browse the repository at this point in the history
* See #175
* See [Feature 9098]
  • Loading branch information
sgarciac authored and eregon committed Oct 22, 2016
1 parent ce4eb8f commit 57c69fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions language/fixtures/squiggly_heredoc.rb
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions language/string_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 57c69fc

Please sign in to comment.