Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit abbbd37

Browse files
committed
Merge pull request #2680 from rspec/update-travis-build-scripts-2019-12-26-for-master
Ruby 2.7 support
1 parent 9bfbd63 commit abbbd37

13 files changed

+63
-37
lines changed

.rubocop_rspec_base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-07-24T15:33:48+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-12-26T17:20:33+00:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
# This file contains defaults for RSpec projects. Individual projects

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-07-24T15:33:48+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-12-26T17:20:33+00:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
# In order to install old Rubies, we need to use old Ubuntu distibution.
@@ -22,9 +22,10 @@ rvm:
2222
- 2.1
2323
- 2.2.10
2424
- 2.3.8
25-
- 2.4.6
26-
- 2.5.5
27-
- 2.6.2
25+
- 2.4.9
26+
- 2.5.7
27+
- 2.6.5
28+
- 2.7.0
2829
- ruby-head
2930
- ree
3031
- rbx-3

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-07-24T15:33:48+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-12-26T17:20:33+00:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
version: "{build}"

lib/rspec/core/filter_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def file_scoped_include?(ex_metadata, ids, locations)
113113

114114
# @private
115115
class FilterRules
116-
PROC_HEX_NUMBER = /0x[0-9a-f]+@/
116+
PROC_HEX_NUMBER = /0x[0-9a-f]+@?/
117117
PROJECT_DIR = File.expand_path('.')
118118

119119
attr_accessor :opposite

lib/rspec/core/option_parser.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ def parse(source=nil)
2222
begin
2323
parser(options).parse!(args)
2424
rescue OptionParser::InvalidOption => e
25-
failure = e.message
26-
failure << " (defined in #{source})" if source
27-
abort "#{failure}\n\nPlease use --help for a listing of valid options"
25+
abort "#{e.message}#{" (defined in #{source})" if source}\n\n" \
26+
"Please use --help for a listing of valid options"
2827
end
2928

3029
options[:files_or_directories_to_run] = args

script/clone_all_rspec_repos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# This file was generated on 2019-07-24T15:33:48+02:00 from the rspec-dev repo.
2+
# This file was generated on 2019-12-26T17:20:33+00:00 from the rspec-dev repo.
33
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
44

55
set -e

script/functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-07-24T15:33:48+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-12-26T17:20:33+00:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

script/predicate_functions.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-07-24T15:33:48+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-12-26T17:20:33+00:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
function is_mri {
@@ -57,6 +57,18 @@ function is_mri_2plus {
5757
fi
5858
}
5959

60+
function is_mri_27 {
61+
if is_mri; then
62+
if ruby -e "exit(RUBY_VERSION.to_f == 2.7)"; then
63+
return 0
64+
else
65+
return 1
66+
fi
67+
else
68+
return 1
69+
fi
70+
}
71+
6072
function is_ruby_23_plus {
6173
if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then
6274
return 0
@@ -81,7 +93,11 @@ function additional_specs_available {
8193
function documentation_enforced {
8294
if [ -x ./bin/yard ]; then
8395
if is_mri_2plus; then
84-
return 0
96+
if is_mri_27; then
97+
return 1
98+
else
99+
return 0
100+
fi
85101
else
86102
return 1
87103
fi

script/run_build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# This file was generated on 2019-07-24T15:33:48+02:00 from the rspec-dev repo.
2+
# This file was generated on 2019-12-26T17:20:33+00:00 from the rspec-dev repo.
33
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
44

55
set -e

script/travis_functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-07-24T15:33:48+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-12-26T17:20:33+00:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
# Taken from:

script/update_rubygems_and_install_bundler

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# This file was generated on 2019-07-24T15:33:48+02:00 from the rspec-dev repo.
2+
# This file was generated on 2019-12-26T17:20:33+00:00 from the rspec-dev repo.
33
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
44

55
set -e

spec/rspec/core/formatters/html_snippet_extractor_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ module Formatters
1212
expect(RSpec::Core::Formatters::HtmlSnippetExtractor.new.lines_around("blech", 8)).to eq("# Couldn't get snippet for blech")
1313
end
1414

15-
it "falls back on a default message when it gets a security error" do
16-
message = with_safe_set_to_level_that_triggers_security_errors do
17-
RSpec::Core::Formatters::HtmlSnippetExtractor.new.lines_around("blech".dup.taint, 8)
15+
if RSpec::Support::RubyFeatures.supports_taint?
16+
it "falls back on a default message when it gets a security error" do
17+
message = with_safe_set_to_level_that_triggers_security_errors do
18+
RSpec::Core::Formatters::HtmlSnippetExtractor.new.lines_around("blech".dup.taint, 8)
19+
end
20+
expect(message).to eq("# Couldn't get snippet for blech")
1821
end
19-
expect(message).to eq("# Couldn't get snippet for blech")
2022
end
2123

2224
describe "snippet extraction" do

spec/support/helper_methods.rb

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,32 @@ def ignoring_warnings
1414
result
1515
end
1616

17-
def with_safe_set_to_level_that_triggers_security_errors
18-
result = nil
17+
# In Ruby 2.7 taint was removed and has no effect, whilst SAFE warns that it
18+
# has no effect and will become a normal varible in 3.0.
19+
if RUBY_VERSION >= '2.7'
20+
def with_safe_set_to_level_that_triggers_security_errors
21+
yield
22+
end
23+
else
24+
def with_safe_set_to_level_that_triggers_security_errors
25+
result = nil
1926

20-
orig_safe = $SAFE
21-
Thread.new do
22-
ignoring_warnings { $SAFE = SAFE_LEVEL_THAT_TRIGGERS_SECURITY_ERRORS }
23-
result = yield
24-
end.join
27+
orig_safe = $SAFE
28+
Thread.new do
29+
ignoring_warnings { $SAFE = SAFE_LEVEL_THAT_TRIGGERS_SECURITY_ERRORS }
30+
result = yield
31+
end.join
2532

26-
# $SAFE is not supported on Rubinius
27-
# In Ruby 2.6, $SAFE became a global variable; previously it was local to a thread.
28-
unless defined?(Rubinius) || SAFE_IS_GLOBAL_VARIABLE
29-
# $SAFE should not have changed in this thread.
30-
expect($SAFE).to eql orig_safe
31-
end
33+
# $SAFE is not supported on Rubinius
34+
# In Ruby 2.6, $SAFE became a global variable; previously it was local to a thread.
35+
unless defined?(Rubinius) || SAFE_IS_GLOBAL_VARIABLE
36+
# $SAFE should not have changed in this thread.
37+
expect($SAFE).to eql orig_safe
38+
end
3239

33-
result
34-
ensure
35-
$SAFE = orig_safe if orig_safe && SAFE_IS_GLOBAL_VARIABLE
40+
result
41+
ensure
42+
$SAFE = orig_safe if orig_safe && SAFE_IS_GLOBAL_VARIABLE
43+
end
3644
end
3745
end

0 commit comments

Comments
 (0)