rubygem-rspec-support/rubygem-rspec-support-3.6.0.beta2-fix-for-ruby-2.4.0-tests.patch
2017-02-06 15:29:41 +09:00

74 lines
2.8 KiB
Diff

diff --git a/spec/rspec/support/fuzzy_matcher_spec.rb b/spec/rspec/support/fuzzy_matcher_spec.rb
index fc92ec5..2c0abec 100644
--- a/spec/rspec/support/fuzzy_matcher_spec.rb
+++ b/spec/rspec/support/fuzzy_matcher_spec.rb
@@ -120,17 +120,17 @@ module RSpec
end
it 'does the fuzzy matching on the individual elements' do
- expect([String, Fixnum]).to match_against(["a", 2])
- expect([String, Fixnum]).not_to match_against([2, "a"])
+ expect([String, Integer]).to match_against(["a", 2])
+ expect([String, Integer]).not_to match_against([2, "a"])
end
it 'returns false if they have a different number of elements' do
- expect([String, Fixnum]).not_to match_against(['a', 2, nil])
+ expect([String, Integer]).not_to match_against(['a', 2, nil])
end
it 'supports arbitrary nested arrays' do
a1 = [
- [String, Fixnum, [be_within(0.1).of(2)]],
+ [String, Integer, [be_within(0.1).of(2)]],
3, [[[ /foo/ ]]]
]
@@ -154,8 +154,8 @@ module RSpec
end
end.new
- expect([Fixnum, String]).to match_against(my_enum)
- expect([String, Fixnum]).not_to match_against(my_enum)
+ expect([Integer, String]).to match_against(my_enum)
+ expect([String, Integer]).not_to match_against(my_enum)
end
it 'does not match an empty hash against an empty array or vice-versa' do
@@ -192,7 +192,7 @@ module RSpec
it 'supports arbitrary nested hashes' do
h1 = {
:a => {
- :b => [String, Fixnum],
+ :b => [String, Integer],
:c => { :d => be_within(0.1).of(2) }
}
}
diff --git a/spec/rspec/support/object_formatter_spec.rb b/spec/rspec/support/object_formatter_spec.rb
index 7e16fb5..6eed58c 100644
--- a/spec/rspec/support/object_formatter_spec.rb
+++ b/spec/rspec/support/object_formatter_spec.rb
@@ -82,10 +82,19 @@ module RSpec
let(:formatted_decimal) { ObjectFormatter.format(decimal) }
- it 'fails with a conventional representation of the decimal' do
- in_sub_process_if_possible do
- require 'bigdecimal'
- expect(formatted_decimal).to include('3.3 (#<BigDecimal')
+ if RUBY_VERSION >= '2.4'
+ it "uses Ruby's BigDecimal formatting since it is improved in 2.4+" do
+ in_sub_process_if_possible do
+ require 'bigdecimal'
+ expect(formatted_decimal).to eq('0.33e1')
+ end
+ end
+ else
+ it 'includes a conventional representation of the decimal' do
+ in_sub_process_if_possible do
+ require 'bigdecimal'
+ expect(formatted_decimal).to include('3.3 (#<BigDecimal')
+ end
end
end