From fbb4d27e3a7cee5076f0f82080f4b68f0bc2bab3 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 26 Oct 2022 01:54:09 +0200 Subject: [PATCH] Fix error when using Appraisal and install_if ```sh An error occurred while loading ./spec/draper/draper_spec.rb. Failure/Error: Bundler.require(*Rails.groups) SyntaxError: /Users/nicolas/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/appraisal-2.5.0/lib/appraisal/gemfile.rb:52: syntax error, unexpected `end' ``` Instead of using a raw String as explained here (https://github.com/thoughtbot/appraisal/pull/176) it uses the interpreted version: ```sh --- |- source "https://rubygems.org" gem "appraisal" gem "capybara" gem "cuprite" gem "database_cleaner" gem "factory_bot" gem "faker" gem "guard-rspec" gem "puma" gem "rake" gem "rspec-rails" gem "rspec-retry" gem "rubocop" gem "rubocop-capybara" gem "rubocop-factory_bot" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "sqlite3", "~> 1.5.0" gem "rails", "6.1.7" install_if # do gem "net-imap" gem "net-pop" gem "net-smtp" end install_if # do gem "base64" gem "bigdecimal" gem "mutex_m" gem "drb" gem "logger" end gemspec path: "../" ``` --- lib/appraisal/conditional.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/appraisal/conditional.rb b/lib/appraisal/conditional.rb index db15ff33..ad2a8e1a 100644 --- a/lib/appraisal/conditional.rb +++ b/lib/appraisal/conditional.rb @@ -16,6 +16,8 @@ def to_s # :nodoc: def for_dup + return unless @condition.is_a?(String) + "install_if #{@condition} do\n#{indent(super)}\nend" end end