diff --git a/.changesets/fix-no-implicit-conversion-of-pathname-into-string-error.md b/.changesets/fix-no-implicit-conversion-of-pathname-into-string-error.md new file mode 100644 index 00000000..0e0492c1 --- /dev/null +++ b/.changesets/fix-no-implicit-conversion-of-pathname-into-string-error.md @@ -0,0 +1,6 @@ +--- +bump: patch +type: fix +--- + +Fix 'no implicit conversion of Pathname into String' error when parsing backtrace lines of error causes in Rails apps. diff --git a/lib/appsignal/config.rb b/lib/appsignal/config.rb index 42399cdd..ee85eb39 100644 --- a/lib/appsignal/config.rb +++ b/lib/appsignal/config.rb @@ -212,7 +212,7 @@ def initialize( root_path, env ) - @root_path = root_path + @root_path = root_path.to_s @config_file_error = false @config_file = config_file @valid = false diff --git a/spec/lib/appsignal/config_spec.rb b/spec/lib/appsignal/config_spec.rb index 40755bd0..e3106725 100644 --- a/spec/lib/appsignal/config_spec.rb +++ b/spec/lib/appsignal/config_spec.rb @@ -371,6 +371,15 @@ def on_load end end + context "when root path is Pathname instance" do + let(:config) { described_class.new(Pathname.new("/path"), "production") } + + it "converts it to a String" do + expect(config.root_path).to eq("/path") + expect(config.root_path).to be_instance_of(String) + end + end + context "without config file" do let(:config) { described_class.new(tmp_dir, "production") }