This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
lib/rspec/core/formatters
spec/rspec/core/formatters Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -246,7 +246,12 @@ def formatted_message_and_backtrace(colorizer)
246
246
247
247
def encoded_description ( description )
248
248
return if description . nil?
249
- encoded_string ( description )
249
+
250
+ if String . method_defined? ( :encoding )
251
+ encoded_string ( description )
252
+ else # for 1.8.7
253
+ description
254
+ end
250
255
end
251
256
252
257
def exception_backtrace
Original file line number Diff line number Diff line change @@ -94,19 +94,21 @@ module RSpec::Core
94
94
EOS
95
95
end
96
96
97
- it 'allows the caller to add encoded description' do
98
- the_presenter = Formatters ::ExceptionPresenter . new ( exception , example ,
99
- :description => "ジ" . encode ( "CP932" ) )
97
+ if String . method_defined? ( :encoding )
98
+ it 'allows the caller to add encoded description' do
99
+ the_presenter = Formatters ::ExceptionPresenter . new ( exception , example ,
100
+ :description => "ジ" . encode ( "CP932" ) )
100
101
101
- expect ( the_presenter . fully_formatted ( 1 ) ) . to eq ( <<-EOS . gsub ( /^ +\| / , '' ) )
102
+ expect ( the_presenter . fully_formatted ( 1 ) ) . to eq ( <<-EOS . gsub ( /^ +\| / , '' ) )
102
103
|
103
104
| 1) ジ
104
105
| Failure/Error: # The failure happened here!#{ encoding_check }
105
106
|
106
107
| Boom
107
108
| Bam
108
109
| # ./spec/rspec/core/formatters/exception_presenter_spec.rb:#{ line_num }
109
- EOS
110
+ EOS
111
+ end
110
112
end
111
113
112
114
it 'allows the caller to omit the description' do
You can’t perform that action at this time.
0 commit comments