-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only parse target Ruby from gemspec if array elements are strings #12756
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#12756](https://github.com/rubocop/rubocop/pull/12756): Only parse target Ruby from gemspec if array elements are strings. ([@davidrunger][]) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,10 +188,25 @@ | |
|
||
context 'when file reads the required_ruby_version from another file' do | ||
it 'uses the default target ruby version' do | ||
content = <<~HEREDOC | ||
content = <<~'HEREDOC' | ||
Gem::Specification.new do |s| | ||
s.name = 'test' | ||
s.required_ruby_version = Gem::Requirement.new(">= #{File.read('.ruby-version').rstrip}") | ||
s.licenses = ['MIT'] | ||
end | ||
HEREDOC | ||
|
||
create_file(gemspec_file_path, content) | ||
expect(target_ruby.version).to eq default_version | ||
end | ||
end | ||
|
||
context 'when file reads the required_ruby_version from another file in an array' do | ||
it 'uses the default target ruby version' do | ||
Comment on lines
+204
to
+205
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the new spec that I am adding for this change. Unfortunately (due to how it looks similar to the spec changed above), GitHub is actually not even including the whole new spec in its rendering of this diff. You'll have to click the down arrow to see the last few lines of this new spec, which GitHub is rendering as if they are preexisting lines. |
||
content = <<~'HEREDOC' | ||
Gem::Specification.new do |s| | ||
s.name = 'test' | ||
s.required_ruby_version = Gem::Requirement.new(">= \#{File.read('.ruby-version').rstrip}") | ||
s.required_ruby_version = [">= #{File.read('.ruby-version').rstrip}"] | ||
s.licenses = ['MIT'] | ||
end | ||
HEREDOC | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This is an existing spec that I only modified to have a heredoc without interpolation; it is otherwise unchanged.)