Skip to content

Commit

Permalink
Add doc for new attribute and add ensure for test
Browse files Browse the repository at this point in the history
  • Loading branch information
igordepolli authored and sl0thentr0py committed Oct 24, 2023
1 parent a0c92b6 commit c51f9e0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
2 changes: 2 additions & 0 deletions sentry-rails/lib/sentry/rails/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class Configuration
# ```
attr_accessor :assets_regexp

# Hash of subscription items that will be shown in breadcrumbs active support logger.
# @return [Hash<String, Array<Symbol>>]
attr_accessor :active_support_logger_subscription_items

def initialize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,28 @@
expect(breadcrumb_buffer.count).to be_zero
end

it "breadcrumb data only contains parameters setted by rails config" do
Sentry.configuration.rails.active_support_logger_subscription_items["process_action.action_controller"].delete(:controller)

get "/exception"

breadcrumbs = event.dig("breadcrumbs", "values")
breadcrumb = breadcrumbs.detect { |b| b["category"] == "process_action.action_controller" }

expect(breadcrumb["data"]).to include(
{
"action" => "exception",
"params" => { "controller" => "hello", "action" => "exception" },
"format" => "html",
"method" => "GET", "path" => "/exception",
}
)
expect(breadcrumb["data"].keys).not_to include("controller")

Sentry.configuration.rails.active_support_logger_subscription_items["process_action.action_controller"] << :controller
context "with modified items" do
before { Sentry.configuration.rails.active_support_logger_subscription_items["process_action.action_controller"].delete(:controller) }
after { Sentry.configuration.rails.active_support_logger_subscription_items["process_action.action_controller"] << :controller }

it "breadcrumb data only contains parameters setted by rails config" do
Sentry.configuration.rails.active_support_logger_subscription_items["process_action.action_controller"].delete(:controller)

get "/exception"

breadcrumbs = event.dig("breadcrumbs", "values")
breadcrumb = breadcrumbs.detect { |b| b["category"] == "process_action.action_controller" }

expect(breadcrumb["data"]).to include(
{
"action" => "exception",
"params" => { "controller" => "hello", "action" => "exception" },
"format" => "html",
"method" => "GET", "path" => "/exception",
}
)
expect(breadcrumb["data"].keys).not_to include("controller")
end
end
end

Expand Down

0 comments on commit c51f9e0

Please sign in to comment.