Skip to content

Commit b4c412c

Browse files
authored
Merge pull request #6 from voxik/ruby-2.7
Ruby 2.7
2 parents 91801d4 + e482984 commit b4c412c

File tree

6 files changed

+35
-16
lines changed

6 files changed

+35
-16
lines changed

.travis.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
language: ruby
22
rvm:
3-
- "1.8.7"
43
- "2.0.0"
5-
- "2.1.10"
6-
- "2.2.6"
7-
- "2.3.3"
8-
- "2.4.0"
4+
- "2.1"
5+
- "2.2"
6+
- "2.3"
7+
- "2.4"
8+
- "2.5"
9+
- "2.6"
10+
- "2.7"
911
- "ruby-head"
10-
env: RUBYOPT=-rubygems
1112
script: rake
12-
matrix:
13-
allow_failures:
14-
- rvm: 1.8.7
15-
env: RUBYOPT=-rubygems

lib/abrt.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
at_exit do
2+
exception = $!
3+
24
# Do not report every exception:
35
# SystemExit - raised by Kernel#exit call
46
# Interrupt - typically issued because the user pressed Ctrl+C
5-
if $! and ![SystemExit, Interrupt].include?($!.class)
6-
require File.join(File.dirname(__FILE__), 'abrt/handler')
7-
ABRT.handle_exception($!)
7+
if exception and ![SystemExit, Interrupt].include?(exception.class)
8+
require_relative 'abrt/handler'
9+
ABRT.handle_exception(exception)
810
end
911
end
1012

lib/abrt/handler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'socket'
22
require 'syslog'
3-
require File.join(File.dirname(__FILE__), 'exception')
3+
require_relative 'exception'
44

55
module ABRT
66

spec/abrt_exception_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1+
require_relative 'spec_helper'
22
require 'abrt/exception'
33

44
describe "ABRT::Exception" do

spec/abrt_handler_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1+
require_relative 'spec_helper'
22
require 'abrt/handler'
33

44
describe "ABRT" do

spec/abrt_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
require_relative 'spec_helper'
2+
3+
describe 'ABRT' do
4+
context "handles exception in 'abrt.rb' with RubyGems" do
5+
abrt_rb = File.join(File.dirname(__FILE__), '../lib/abrt.rb')
6+
output_message_pattern = /\A#{abrt_rb}:\d+:in `<main>': can't modify frozen Array(: \[1, 2, 3\])? \((FrozenError|RuntimeError)\)\n\Z/
7+
8+
it 'disabled' do
9+
expect { system "ruby --disable-gems #{abrt_rb}" }
10+
.to output(/\A\Z/).to_stdout_from_any_process
11+
.and output(output_message_pattern).to_stderr_from_any_process
12+
end
13+
14+
it 'enabled' do
15+
expect { system "ruby --disable-gems -rrubygems #{abrt_rb}" }
16+
.to output(/\A\Z/).to_stdout_from_any_process
17+
.and output(output_message_pattern).to_stderr_from_any_process
18+
end
19+
end
20+
end

0 commit comments

Comments
 (0)