rspec-expectations 2.14.0 → 2.14.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,12 @@
1
+ ### 2.14.1 / 2013-08-08
2
+ [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0...2.14.1)
3
+
4
+ Bug fixes
5
+
6
+ * Ensure diff output uses the same encoding as the encoding of
7
+ the string being diff'd to prevent `Encoding::UndefinedConversionError`
8
+ errors (Jon Rowe).
9
+
1
10
  ### 2.14.0 / 2013-07-06
2
11
  [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0.rc1...v2.14.0)
3
12
 
@@ -0,0 +1,6 @@
1
+ # Required until https://github.com/rubinius/rubinius/issues/2430 is resolved
2
+ ENV['RBXOPT'] = "#{ENV["RBXOPT"]} -Xcompiler.no_rbc"
3
+
4
+ Around "@unsupported-on-rbx" do |scenario, block|
5
+ block.call unless defined?(Rubinius)
6
+ end
@@ -107,8 +107,15 @@ module RSpec
107
107
  def object_to_string(object)
108
108
  case object
109
109
  when Hash
110
- object.keys.sort_by { |k| k.to_s }.map do |k|
111
- %(#{PP.singleline_pp(k, "")} => #{PP.singleline_pp(object[k], "")})
110
+ object.keys.sort_by { |k| k.to_s }.map do |key|
111
+ pp_key = PP.singleline_pp(key, "")
112
+ pp_value = PP.singleline_pp(object[key], "")
113
+
114
+ # on 1.9.3 PP seems to minimise to US-ASCII, ensure we're matching source encoding
115
+ #
116
+ # note, PP is used to ensure the ordering of the internal values of key/value e.g.
117
+ # <# a: b: c:> not <# c: a: b:>
118
+ matching_encoding("#{pp_key} => #{pp_value}", key)
112
119
  end.join(",\n")
113
120
  when String
114
121
  object =~ /\n/ ? object : object.inspect
@@ -2,7 +2,7 @@ module RSpec
2
2
  module Expectations
3
3
  # @private
4
4
  module Version
5
- STRING = '2.14.0'
5
+ STRING = '2.14.1'
6
6
  end
7
7
  end
8
8
  end
@@ -137,6 +137,17 @@ EOD
137
137
  expect(diff).to eq expected_diff
138
138
  end
139
139
 
140
+ it 'outputs unified diff messaoge of two hashes with differing encoding' do
141
+ expected_diff = %Q{
142
+ @@ -1,2 +1,2 @@
143
+ -"a" => "a"
144
+ #{ (RUBY_VERSION.to_f > 1.8) ? %Q{+"ö" => "ö"} : '+"\303\266" => "\303\266"' }
145
+ }
146
+
147
+ diff = differ.diff_as_object({'ö' => 'ö'}, {'a' => 'a'})
148
+ expect(diff).to eq expected_diff
149
+ end
150
+
140
151
  it "outputs unified diff of single line strings" do
141
152
  expected = "this is one string"
142
153
  actual = "this is another string"
@@ -16,8 +16,8 @@ describe "expect { ... }.to raise_error" do
16
16
  end
17
17
 
18
18
  it "fails if a different error instance is thrown from the one that is expected" do
19
- s = StandardError.new :bees
20
- to_raise = StandardError.new(:faces)
19
+ s = StandardError.new("Error 1")
20
+ to_raise = StandardError.new("Error 2")
21
21
  expect do
22
22
  expect {raise to_raise}.to raise_error(s)
23
23
  end.to fail_with(Regexp.new("expected #{s.inspect}, got #{to_raise.inspect} with backtrace"))
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rspec-expectations
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.14.0
5
+ version: 2.14.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Steven Baker
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-06 00:00:00.000000000 Z
13
+ date: 2013-08-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  version_requirements: !ruby/object:Gem::Requirement
@@ -173,6 +173,7 @@ files:
173
173
  - features/implicit_docstrings.feature
174
174
  - features/step_definitions/additional_cli_steps.rb
175
175
  - features/support/env.rb
176
+ - features/support/rubinius.rb
176
177
  - features/syntax_configuration.feature
177
178
  - features/test_frameworks/test_unit.feature
178
179
  - spec/rspec/expectations/differ_spec.rb
@@ -233,7 +234,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
233
234
  version: '0'
234
235
  segments:
235
236
  - 0
236
- hash: -2919541554530046896
237
+ hash: 1211748927981190592
237
238
  none: false
238
239
  required_rubygems_version: !ruby/object:Gem::Requirement
239
240
  requirements:
@@ -242,14 +243,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
243
  version: '0'
243
244
  segments:
244
245
  - 0
245
- hash: -2919541554530046896
246
+ hash: 1211748927981190592
246
247
  none: false
247
248
  requirements: []
248
249
  rubyforge_project: rspec
249
250
  rubygems_version: 1.8.24
250
251
  signing_key:
251
252
  specification_version: 3
252
- summary: rspec-expectations-2.14.0
253
+ summary: rspec-expectations-2.14.1
253
254
  test_files:
254
255
  - features/README.md
255
256
  - features/Upgrade.md
@@ -283,6 +284,7 @@ test_files:
283
284
  - features/implicit_docstrings.feature
284
285
  - features/step_definitions/additional_cli_steps.rb
285
286
  - features/support/env.rb
287
+ - features/support/rubinius.rb
286
288
  - features/syntax_configuration.feature
287
289
  - features/test_frameworks/test_unit.feature
288
290
  - spec/rspec/expectations/differ_spec.rb