activesupport 7.1.2 → 7.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,6 +32,8 @@ module ActiveSupport
32
32
  end
33
33
 
34
34
  def backtrace_locations
35
+ return nil if super.nil?
36
+
35
37
  parse_message_for_trace.map { |trace|
36
38
  file, line = trace.match(/^(.+?):(\d+).*$/, &:captures) || trace
37
39
  BacktraceLocation.new(file, line.to_i, trace)
@@ -43,7 +45,26 @@ module ActiveSupport
43
45
 
44
46
  private
45
47
  def parse_message_for_trace
46
- __getobj__.to_s.split("\n")
48
+ if source_location_eval?
49
+ # If the exception is coming from a call to eval, we need to keep
50
+ # the path of the file in which eval was called to ensure we can
51
+ # return the right source fragment to show the location of the
52
+ # error
53
+ location = __getobj__.backtrace_locations[0]
54
+ ["#{location.path}:#{location.lineno}: #{__getobj__}"]
55
+ else
56
+ __getobj__.to_s.split("\n")
57
+ end
58
+ end
59
+
60
+ if SyntaxError.method_defined?(:path) # Ruby 3.3+
61
+ def source_location_eval?
62
+ __getobj__.path.start_with?("(eval")
63
+ end
64
+ else # 3.2 and older versions of Ruby
65
+ def source_location_eval?
66
+ __getobj__.to_s.start_with?("(eval")
67
+ end
47
68
  end
48
69
  end
49
70
  end
@@ -223,7 +223,7 @@ module ActiveSupport
223
223
  # post :create, params: { status: { ok: true } }
224
224
  # end
225
225
  #
226
- # Provide the optional keyword argument :from to specify the expected
226
+ # Provide the optional keyword argument +:from+ to specify the expected
227
227
  # initial value.
228
228
  #
229
229
  # assert_no_changes -> { Status.all_good? }, from: true do
@@ -169,6 +169,10 @@ module ActiveSupport
169
169
  now = date_or_time.to_time.change(usec: 0)
170
170
  end
171
171
 
172
+ # +now+ must be in local system timezone, because +Time.at(now)+
173
+ # and +now.to_date+ (see stubs below) will use +now+'s timezone too!
174
+ now = now.getlocal
175
+
172
176
  stubs = simple_stubs
173
177
  stubbed_time = Time.now if stubs.stubbing(Time, :now)
174
178
  stubs.stub_object(Time, :now) { at(now) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.2
4
+ version: 7.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-10 00:00:00.000000000 Z
11
+ date: 2024-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -446,10 +446,10 @@ licenses:
446
446
  - MIT
447
447
  metadata:
448
448
  bug_tracker_uri: https://github.com/rails/rails/issues
449
- changelog_uri: https://github.com/rails/rails/blob/v7.1.2/activesupport/CHANGELOG.md
450
- documentation_uri: https://api.rubyonrails.org/v7.1.2/
449
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.3/activesupport/CHANGELOG.md
450
+ documentation_uri: https://api.rubyonrails.org/v7.1.3/
451
451
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
452
- source_code_uri: https://github.com/rails/rails/tree/v7.1.2/activesupport
452
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.3/activesupport
453
453
  rubygems_mfa_required: 'true'
454
454
  post_install_message:
455
455
  rdoc_options: