From 0d172507a40e0f3ba8c9fe2756f6bf308136f9c2 Mon Sep 17 00:00:00 2001 From: Josh Cheek Date: Wed, 13 Jan 2021 06:47:41 -0600 Subject: [PATCH] Update to work on 3.0 --- .github/workflows/test.yml | 2 +- features/regression.feature | 26 ------------------- .../event_stream/producer.rb | 1 + 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5107b6f..2ce91c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.5', '2.6', '2.7'] + ruby-version: ['2.5', '2.6', '2.7', '3.0'] steps: - uses: actions/checkout@v2 diff --git a/features/regression.feature b/features/regression.feature index ba2bbf6..77a6a17 100644 --- a/features/regression.feature +++ b/features/regression.feature @@ -470,32 +470,6 @@ Feature: """ - # See this issue for the issue we're testing for: https://github.com/JoshCheek/seeing_is_believing/issues/46 - # See this issue for why we turn it off on 2.4: https://github.com/flori/json/issues/309 - # - # Not going to get too detailed on what it prints, b/c that message seems pretty fragile, - # but just generally that it doesn't fkn blow up - @not-2.4 - @not-2.5 - @not-2.6 - @not-2.7 - Scenario: Old JSON bug - Given the file "json_and_encodings.rb": - """ - # encoding: utf-8 - require 'json' - JSON.parse JSON.dump("√") - """ - When I run "seeing_is_believing json_and_encodings.rb" - Then stderr is empty - And the exit status is 1 - And stdout includes: - """ - require 'json' # => true - JSON.parse JSON.dump("√") - """ - - # https://github.com/JoshCheek/seeing_is_believing/wiki/Encodings # https://github.com/JoshCheek/seeing_is_believing/issues/109 Scenario: Assumes utf-8 for files regardless of what Ruby thinks diff --git a/lib/seeing_is_believing/event_stream/producer.rb b/lib/seeing_is_believing/event_stream/producer.rb index 1ada0d9..09ee4f2 100644 --- a/lib/seeing_is_believing/event_stream/producer.rb +++ b/lib/seeing_is_believing/event_stream/producer.rb @@ -11,6 +11,7 @@ class Producer # Guarding against hostile users (e.g. me) that do ridiculous things like blowing away these constants old_w, $-w = $-w, nil # Ruby warns about accessing deprecated constants Object.constants.each do |name| + next if name == :SortedSet # Removed in 3.0, but apparently the constant still exists, it just explodes if you reference it const_set name, Object.const_get(name) end $-w = old_w