FIX: rss gem is bundled gem since Ruby 3 (PR #14350)

This pull request address cannot load such file -- rss with Ruby 3 since rss is a bundled gem since Ruby 3 https://github.com/ruby/ruby/pull/2832

  • Steps to reproduce
% ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin21]
% bundle exec rake db:create
% bundle exec rake db:migrate
% RAILS_ENV=test bundle exec rake db:create db:migrate
% bundle exec rspec ./spec/components/feed_element_installer_spec.rb ./spec/components/feed_item_accessor_spec.rb
  • Actual result without this commit:
% bundle exec rspec ./spec/components/feed_element_installer_spec.rb ./spec/components/feed_item_accessor_spec.rb                                                                                                         main

An error occurred while loading ./spec/components/feed_element_installer_spec.rb. - Did you mean?
                    rspec ./spec/components/feed_item_accessor_spec.rb

Failure/Error: require 'rss'

LoadError:
  cannot load such file -- rss
# ./lib/feed_element_installer.rb:4:in `require'
# ./lib/feed_element_installer.rb:4:in `<top (required)>'
# ./spec/components/feed_element_installer_spec.rb:3:in `require'
# ./spec/components/feed_element_installer_spec.rb:3:in `<top (required)>'

An error occurred while loading ./spec/components/feed_item_accessor_spec.rb. - Did you mean?
                    rspec ./spec/components/email/processor_spec.rb
                    rspec ./spec/components/cooked_post_processor_spec.rb

Failure/Error: require 'rss'

LoadError:
  cannot load such file -- rss
# ./spec/components/feed_item_accessor_spec.rb:3:in `require'
# ./spec/components/feed_item_accessor_spec.rb:3:in `<top (required)>'
No examples found.


Finished in 0.00005 seconds (files took 0.88278 seconds to load)
0 examples, 0 failures, 2 errors occurred outside of examples

%
  • With this fix
% bundle exec rspec ./spec/components/feed_element_installer_spec.rb ./spec/components/feed_item_accessor_spec.rb                                                                                  rss_is_bundled_gem_in_ruby3

Randomized with seed 40133
........

Finished in 0.41425 seconds (files took 6.31 seconds to load)
8 examples, 0 failures

Randomized with seed 40133

%

I understand Discourse itself does not support Ruby 3 yet, still, it would contribute to preparing it.

GitHub

gem 'ruby-readability', require: false

# rss gem is a bundled gem from Ruby 3 onwards
gem 'rss', require: false

Looks good to me and thank you for your contribution.

@tgxworld any reason why you didn’t merge?

@eviltrout I’m planning to merge this next monday. The PR is pretty low risk but I didn’t want to merge it in towards the end of the week.