rubygem-rspec-support/0009-Update-nodes_by_line_number-spec-for-change-in-Ruby-.patch
2019-02-05 12:45:35 +09:00

42 lines
1.5 KiB
Diff

From a0e30cc7c8021067b78510b7cd29a7442adc34cb Mon Sep 17 00:00:00 2001
From: Jon Rowe <hello@jonrowe.co.uk>
Date: Wed, 26 Dec 2018 22:31:28 +0000
Subject: [PATCH 09/13] Update nodes_by_line_number spec for change in Ruby
behaviour
---
spec/rspec/support/source_spec.rb | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/spec/rspec/support/source_spec.rb b/spec/rspec/support/source_spec.rb
index 0e3d569..56532ce 100644
--- a/spec/rspec/support/source_spec.rb
+++ b/spec/rspec/support/source_spec.rb
@@ -79,10 +79,19 @@ module RSpec::Support
describe '#nodes_by_line_number' do
it 'returns a hash containing nodes for each line number' do
expect(source.nodes_by_line_number).to match(
- 1 => [
- an_object_having_attributes(:type => :@int),
- an_object_having_attributes(:type => :@ident)
- ],
+ 1 =>
+ if RUBY_VERSION >= '2.6.0'
+ [
+ an_object_having_attributes(:type => :@int),
+ an_object_having_attributes(:type => :@period),
+ an_object_having_attributes(:type => :@ident)
+ ]
+ else
+ [
+ an_object_having_attributes(:type => :@int),
+ an_object_having_attributes(:type => :@ident)
+ ]
+ end,
2 => [
an_object_having_attributes(:type => :@ident),
an_object_having_attributes(:type => :@ident)
--
2.20.1