-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Module#prepend for Rake integration if Ruby version is new enough
This might fix #556 If another gem uses `Module#prepend` on `Rake::Task`, then it can lead to infinite mutual recursion if we use alias_method to monkey patch the `#execute` method.
- Loading branch information
Toby Hsieh
committed
Aug 14, 2019
1 parent
df85d64
commit c52a9a7
Showing
3 changed files
with
77 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,18 +55,15 @@ | |
let(:request) { JSON.parse(queue.pop) } | ||
|
||
it 'should run the rake middleware when rake tasks crash' do | ||
#Skips this test in ruby 1.9.3 with travis | ||
unless ENV['TRAVIS'] && RUBY_VERSION == "1.9.3" | ||
ENV['BUGSNAG_TEST_SERVER_PORT'] = server.config[:Port].to_s | ||
task_fixtures_path = File.join(File.dirname(__FILE__), '../fixtures', 'tasks') | ||
Dir.chdir(task_fixtures_path) do | ||
system("bundle exec rake test:crash > /dev/null 2>&1") | ||
end | ||
|
||
result = request() | ||
expect(result["events"][0]["metaData"]["rake_task"]).not_to be_nil | ||
expect(result["events"][0]["metaData"]["rake_task"]["name"]).to eq("test:crash") | ||
ENV['BUGSNAG_TEST_SERVER_PORT'] = server.config[:Port].to_s | ||
task_fixtures_path = File.join(File.dirname(__FILE__), '../fixtures', 'tasks') | ||
Dir.chdir(task_fixtures_path) do | ||
system("bundle exec rake test:crash > /dev/null 2>&1") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tobyhs
Contributor
|
||
end | ||
|
||
result = request() | ||
expect(result["events"][0]["metaData"]["rake_task"]).not_to be_nil | ||
expect(result["events"][0]["metaData"]["rake_task"]["name"]).to eq("test:crash") | ||
end | ||
end | ||
end | ||
end |
The crash in my app would happen when using
Rake::Task['test:crash'].invoke
(which has already loaded everything).