diff --git a/fastlane/spec/plugins_specs/plugin_generator_spec.rb b/fastlane/spec/plugins_specs/plugin_generator_spec.rb index 4a4dda0a582..8a5333ea592 100644 --- a/fastlane/spec/plugins_specs/plugin_generator_spec.rb +++ b/fastlane/spec/plugins_specs/plugin_generator_spec.rb @@ -111,7 +111,9 @@ end it "creates a plugin.rb file for the plugin" do - plugin_rb_file = File.join(tmp_dir, gem_name, 'lib', 'fastlane', 'plugin', "#{plugin_name}.rb") + relative_path = File.join('lib', 'fastlane', 'plugin', "#{plugin_name}.rb") + plugin_rb_file = File.join(tmp_dir, gem_name, relative_path) + expect(File.exist?(plugin_rb_file)).to be(true) plugin_rb_contents = File.read(plugin_rb_file) @@ -122,7 +124,10 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) # rubocop:disable Security/Eval - eval(plugin_rb_contents) + # starting with ruby 3.3 we must pass the __FILE__ of the actual file location for the all_class method implementation to work + # also we expand the relative_path within the chdir, as Dir.chdir on Mac will make it so tmp paths will always be under /private, + # while expand_path called from outside of the chdir will not prefix by /private + eval(plugin_rb_contents, binding, File.expand_path(relative_path), __LINE__) # rubocop:enable Security/Eval # If we evaluate the contents of the generated plugin.rb file,