Skip to content

Commit

Permalink
Update pbbuilder and fix show_exceptions? errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
svanhesteren committed Sep 5, 2024
1 parent ee18000 commit ada8568
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.0
3.3.3
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source "https://rubygems.org"
gemspec

gem "sqlite3"
gem "pbbuilder"
gem "pbbuilder", github: "cheddar-me/pbbuilder", branch: "use-system-basic-object"
gem "standard"
gem "pry"

Expand Down
23 changes: 21 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,27 @@ require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
t.verbose = false
t.libs << "lib"

# Running specific tests with line numbers, like with rails test, is not supported by default in rake.
# By setting the TESTOPS env var we can however specify the name of a single test with underscores instead of spaces.
# So run your single test by calling for ex:
#
# rake test /Users/sebastian/projects/cheddar/rails-twirp/test/ping_controller_test.rb "uncaught errors should bubble up to the test"

file_name = ARGV[1]
test_name = ARGV[2]&.tr(" ", "_")

ENV["TESTOPTS"] = "--verbose"

t.test_files = if file_name
if test_name
ENV["TESTOPTS"] = ENV["TESTOPTS"] + " --name=#{test_name}"
end
[file_name]
else
FileList["test/**/*_test.rb"]
end
end

task default: :test
2 changes: 1 addition & 1 deletion lib/rails_twirp/exception_handling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def process_action(*)
# 1. When we 'show exceptions' we make the exception bubble up—this is useful for testing
# If the exception gets raised here error reporting will happen in the middleware of the APM package
# higher in the call stack.
raise e unless http_request.show_exceptions?
raise e unless http_request.get_header("action_dispatch.show_exceptions")

# 2. We report the error to the error tracking service, this needs to be configured.
RailsTwirp.unhandled_exception_handler&.call(e)
Expand Down
2 changes: 1 addition & 1 deletion lib/rails_twirp/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module RailsTwirp
VERSION = "0.16"
VERSION = "0.17"
end
9 changes: 4 additions & 5 deletions rails_twirp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ Gem::Specification.new do |spec|

spec.files = `git ls-files`.split("\n")

# Rails has shipped an incompatible change in ActiveView, that was reverted in later versions
# but at this time has not been released as a 7.x version
# @see https://github.com/rails/rails/pull/51023
spec.add_runtime_dependency "rails", ">= 6.1.3", " < 7.1"
spec.add_runtime_dependency "twirp", ">= 1.9", "< 1.11"
spec.add_runtime_dependency "rails", ">= 6.1.3", "!= 7.1"
spec.add_runtime_dependency "twirp", ">= 1.9"
spec.add_development_dependency "pry"

spec.required_ruby_version = ">= 3"
end
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
require "rails/test_help"
require "rails/test_unit/reporter"
require "pry"
Rails::TestUnitReporter.executable = "bin/test"

# Load fixtures from the engine
Expand Down

0 comments on commit ada8568

Please sign in to comment.