Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pathname to String conversion error #1310

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion lib/appsignal/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/appsignal/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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") }

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/appsignal/integrations/railtie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def initialize_railtie(event)
it "sets the Rails app path as root_path" do
initialize_railtie(event)

expect(Appsignal.config.root_path).to eq(Pathname.new(rails_project_fixture_path))
expect(Appsignal.config.root_path).to eq(rails_project_fixture_path)
end

it "loads the Rails app name in the initial config" do
Expand Down
Loading