Skip to content

Commit 4ad054c

Browse files
committedMay 20, 2015
Avoid string mutating methods in deprecation warn.
fixes #20
1 parent 617560c commit 4ad054c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
 

Diff for: ‎opal/opal/rspec/fixes.rb

+15
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,18 @@ def is_expected
7878
end
7979
end
8080
end
81+
82+
RSpec::Core::Formatters::DeprecationFormatter::GeneratedDeprecationMessage.class_eval do
83+
def to_s
84+
msg = "#{@data[:deprecated]} is deprecated."
85+
msg += " Use #{@data[:replacement]} instead." if @data[:replacement]
86+
msg += " Called from #{@data[:call_site]}." if @data[:call_site]
87+
msg
88+
end
89+
90+
def too_many_warnings_message
91+
msg = "Too many uses of deprecated '#{type}'."
92+
msg += " Set config.deprecation_stream to a File for full output."
93+
msg
94+
end
95+
end

Diff for: ‎spec/mock_spec.rb

+6
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,10 @@
5454
expect(Time).to receive(:now).once.and_call_original
5555
Time.now.should be_kind_of(Time)
5656
end
57+
58+
describe 'stubs' do
59+
it 'works and displays deprecation' do
60+
Object.new.stub :foo
61+
end
62+
end
5763
end

0 commit comments

Comments
 (0)
Please sign in to comment.