File: 0003-Convert-specs-to-RSpec-2.99.2-syntax-with-Transpec.patch

package info (click to toggle)
ruby-mixlib-versioning 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 320 kB
  • sloc: ruby: 1,374; makefile: 3
file content (335 lines) | stat: -rw-r--r-- 14,142 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
From: Hleb Valoshka <375gnu@gmail.com>
Date: Tue, 12 Apr 2016 16:17:10 +0300
Subject: Convert specs to RSpec 2.99.2 syntax with Transpec

This conversion is done by Transpec 3.2.1 with the following command:
    transpec

* 29 conversions
    from: obj.should
      to: expect(obj).to

* 14 conversions
    from: be_false
      to: be_falsey

* 6 conversions
    from: be_true
      to: be_truthy

* 1 conversion
    from: == expected
      to: eq(expected)

For more details: https://github.com/yujinakayama/transpec#supported-conversions
---
 spec/mixlib/versioning/format_spec.rb              |  2 +-
 spec/mixlib/versioning/versioning_spec.rb          | 32 ++++++++---------
 .../shared_examples/behaviors/filterable.rb        | 10 +++---
 .../shared_examples/behaviors/serializable.rb      |  6 ++--
 spec/support/shared_examples/behaviors/sortable.rb |  8 ++---
 spec/support/shared_examples/semver.rb             | 40 +++++++++++-----------
 6 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/spec/mixlib/versioning/format_spec.rb b/spec/mixlib/versioning/format_spec.rb
index 02dabf5..8aebbf0 100644
--- a/spec/mixlib/versioning/format_spec.rb
+++ b/spec/mixlib/versioning/format_spec.rb
@@ -39,7 +39,7 @@ describe Mixlib::Versioning::Format do
       context 'format_type is a: #{format_type.class}' do
         let(:format_type) { format_type }
         it 'returns the correct format class' do
-          subject.for(format_type).should eq Mixlib::Versioning::Format::Rubygems
+          expect(subject.for(format_type)).to eq Mixlib::Versioning::Format::Rubygems
         end # it
       end # context
     end # each
diff --git a/spec/mixlib/versioning/versioning_spec.rb b/spec/mixlib/versioning/versioning_spec.rb
index cef017b..fe6dfe3 100644
--- a/spec/mixlib/versioning/versioning_spec.rb
+++ b/spec/mixlib/versioning/versioning_spec.rb
@@ -59,7 +59,7 @@ describe Mixlib::Versioning do
             context "format type as a: #{format_type.class}" do
               it "parses version string as: #{options[:expected_format]}" do
                 result = subject.parse(version_string, format_type)
-                result.should be_a(expected_format)
+                expect(result).to be_a(expected_format)
               end # it
             end # context
           end # each
@@ -106,7 +106,7 @@ describe Mixlib::Versioning do
         context version_string do
           let(:version_string) { version_string }
           it "parses version string as: #{expected_format}" do
-            subject.parse(version_string).should be_a(expected_format)
+            expect(subject.parse(version_string)).to be_a(expected_format)
           end # it
         end # context
       end # each_pair
@@ -114,7 +114,7 @@ describe Mixlib::Versioning do
       describe 'version_string cannot be parsed' do
         let(:version_string) { 'A.B.C' }
         it 'returns nil' do
-          subject.parse(version_string).should be_nil
+          expect(subject.parse(version_string)).to be_nil
         end
       end
     end # describe "parsing with automatic format detection"
@@ -123,7 +123,7 @@ describe Mixlib::Versioning do
       it 'returns the same object' do
         v = Mixlib::Versioning.parse(version_string)
         result = subject.parse(v)
-        v.should be result
+        expect(v).to be result
       end
     end
 
@@ -131,15 +131,15 @@ describe Mixlib::Versioning do
       context 'when the format is not in the list' do
         let(:version_string) { '10.16.2-rc.2-49-g21353f0' }
         it 'returns nil when the array contains a Mixlib::Versioning::Format' do
-          subject.parse(version_string, [Mixlib::Versioning::Format::Rubygems]).should be_nil
+          expect(subject.parse(version_string, [Mixlib::Versioning::Format::Rubygems])).to be_nil
         end
 
         it 'returns nil when the array contains a string' do
-          subject.parse(version_string, ['rubygems']).should be_nil
+          expect(subject.parse(version_string, ['rubygems'])).to be_nil
         end
 
         it 'returns nil when the array contains a symbol' do
-          subject.parse(version_string, [:rubygems]).should be_nil
+          expect(subject.parse(version_string, [:rubygems])).to be_nil
         end
       end
 
@@ -147,15 +147,15 @@ describe Mixlib::Versioning do
         let(:version_string) { '10.16.2-rc.2-49-g21353f0' }
         let(:expected_format) { Mixlib::Versioning::Format::GitDescribe }
         it 'returns nil when the array contains a Mixlib::Versioning::Format' do
-          subject.parse(version_string, [expected_format]).should be_a(expected_format)
+          expect(subject.parse(version_string, [expected_format])).to be_a(expected_format)
         end
 
         it 'returns nil when the array contains a string' do
-          subject.parse(version_string, ['git_describe']).should be_a(expected_format)
+          expect(subject.parse(version_string, ['git_describe'])).to be_a(expected_format)
         end
 
         it 'returns nil when the array contains a symbol' do
-          subject.parse(version_string, [:git_describe]).should be_a(expected_format)
+          expect(subject.parse(version_string, [:git_describe])).to be_a(expected_format)
         end
       end
     end
@@ -223,7 +223,7 @@ describe Mixlib::Versioning do
         let(:expected_version) { options[:releases_only] }
 
         it 'finds the most recent release version' do
-          subject_find.should eq Mixlib::Versioning.parse(expected_version)
+          expect(subject_find).to eq Mixlib::Versioning.parse(expected_version)
         end
 
         context 'include pre-release versions' do
@@ -231,7 +231,7 @@ describe Mixlib::Versioning do
           let(:expected_version) { options[:prerelease_versions] }
 
           it 'finds the most recent pre-release version' do
-            subject_find.should eq Mixlib::Versioning.parse(expected_version)
+            expect(subject_find).to eq Mixlib::Versioning.parse(expected_version)
           end # it
         end # context
 
@@ -240,7 +240,7 @@ describe Mixlib::Versioning do
           let(:expected_version) { options[:build_versions] }
 
           it 'finds the most recent build version' do
-            subject_find.should eq Mixlib::Versioning.parse(expected_version)
+            expect(subject_find).to eq Mixlib::Versioning.parse(expected_version)
           end # it
         end # context
 
@@ -250,7 +250,7 @@ describe Mixlib::Versioning do
           let(:expected_version) { options[:prerelease_and_build_versions] }
 
           it 'finds the most recent pre-release build version' do
-            subject_find.should eq Mixlib::Versioning.parse(expected_version)
+            expect(subject_find).to eq Mixlib::Versioning.parse(expected_version)
           end # it
         end # context
       end # context
@@ -266,7 +266,7 @@ describe Mixlib::Versioning do
       end
 
       it 'correctly parses the array' do
-        subject_find.should eq Mixlib::Versioning.parse('11.0.0')
+        expect(subject_find).to eq Mixlib::Versioning.parse('11.0.0')
       end
     end # describe
 
@@ -274,7 +274,7 @@ describe Mixlib::Versioning do
       let(:filter_version) { Mixlib::Versioning::Format::SemVer.new('11.0.0') }
 
       it 'finds the correct version' do
-        subject_find.should eq Mixlib::Versioning.parse('11.0.0')
+        expect(subject_find).to eq Mixlib::Versioning.parse('11.0.0')
       end
     end
   end # describe
diff --git a/spec/support/shared_examples/behaviors/filterable.rb b/spec/support/shared_examples/behaviors/filterable.rb
index f7dda81..55fdb0f 100644
--- a/spec/support/shared_examples/behaviors/filterable.rb
+++ b/spec/support/shared_examples/behaviors/filterable.rb
@@ -29,26 +29,26 @@ shared_examples 'filterable' do
   let(:prerelease_build_versions) { [] }
 
   it 'filters by release versions only' do
-    unsorted_versions.select(&:release?).should eq(release_versions.map { |v| described_class.new(v) })
+    expect(unsorted_versions.select(&:release?)).to eq(release_versions.map { |v| described_class.new(v) })
   end # it
 
   it 'filters by pre-release versions only' do
     filtered = unsorted_versions.select(&:prerelease?)
-    filtered.should eq(prerelease_versions.map { |v| described_class.new(v) })
+    expect(filtered).to eq(prerelease_versions.map { |v| described_class.new(v) })
   end # it
 
   it 'filters by build versions only' do
     filtered = unsorted_versions.select(&:build?)
-    filtered.should eq(build_versions.map { |v| described_class.new(v) })
+    expect(filtered).to eq(build_versions.map { |v| described_class.new(v) })
   end # it
 
   it 'filters by release build versions only' do
     filtered = unsorted_versions.select(&:release_build?)
-    filtered.should eq(release_build_versions.map { |v| described_class.new(v) })
+    expect(filtered).to eq(release_build_versions.map { |v| described_class.new(v) })
   end # it
 
   it 'filters by pre-release build versions only' do
     filtered = unsorted_versions.select(&:prerelease_build?)
-    filtered.should eq(prerelease_build_versions.map { |v| described_class.new(v) })
+    expect(filtered).to eq(prerelease_build_versions.map { |v| described_class.new(v) })
   end # it
 end # shared_examples
diff --git a/spec/support/shared_examples/behaviors/serializable.rb b/spec/support/shared_examples/behaviors/serializable.rb
index 53fb8a3..b911e78 100644
--- a/spec/support/shared_examples/behaviors/serializable.rb
+++ b/spec/support/shared_examples/behaviors/serializable.rb
@@ -20,7 +20,7 @@ shared_examples 'serializable' do |version_strings|
   describe '#to_s' do
     version_strings.each do |v|
       it "reconstructs the initial input for #{v}" do
-        described_class.new(v).to_s.should == v
+        expect(described_class.new(v).to_s).to eq(v)
       end # it
     end # version_strings
   end # describe
@@ -31,7 +31,7 @@ shared_examples 'serializable' do |version_strings|
         subject = described_class.new(v)
         string = subject.to_semver_string
         semver = Mixlib::Versioning::Format::SemVer.new(string)
-        string.should eq semver.to_s
+        expect(string).to eq semver.to_s
       end # it
     end # version_strings
   end # describe
@@ -42,7 +42,7 @@ shared_examples 'serializable' do |version_strings|
         subject = described_class.new(v)
         string = subject.to_rubygems_string
         rubygems = Mixlib::Versioning::Format::Rubygems.new(string)
-        string.should eq rubygems.to_s
+        expect(string).to eq rubygems.to_s
       end # it
     end # version_strings
   end # describe
diff --git a/spec/support/shared_examples/behaviors/sortable.rb b/spec/support/shared_examples/behaviors/sortable.rb
index ffbcb23..8eae402 100644
--- a/spec/support/shared_examples/behaviors/sortable.rb
+++ b/spec/support/shared_examples/behaviors/sortable.rb
@@ -26,18 +26,18 @@ shared_examples 'sortable' do
   end
 
   it 'responds to <=>' do
-    described_class.should respond_to(:<=>)
+    expect(described_class).to respond_to(:<=>)
   end
 
   it 'sorts all properly' do
-    unsorted_versions.sort.should eq sorted_versions
+    expect(unsorted_versions.sort).to eq sorted_versions
   end
 
   it 'finds the min' do
-    unsorted_versions.min.should eq described_class.new(min)
+    expect(unsorted_versions.min).to eq described_class.new(min)
   end
 
   it 'finds the max' do
-    unsorted_versions.max.should eq described_class.new(max)
+    expect(unsorted_versions.max).to eq described_class.new(max)
   end
 end # shared_examples
diff --git a/spec/support/shared_examples/semver.rb b/spec/support/shared_examples/semver.rb
index 35c2473..6962ffb 100644
--- a/spec/support/shared_examples/semver.rb
+++ b/spec/support/shared_examples/semver.rb
@@ -80,38 +80,38 @@ shared_examples Mixlib::Versioning::Format::SemVer do
   describe 'build qualification' do
     context 'release version' do
       let(:version_string) { '1.0.0' }
-      its(:release?) { should be_true }
-      its(:prerelease?) { should be_false }
-      its(:build?) { should be_false }
-      its(:release_build?) { should be_false }
-      its(:prerelease_build?) { should be_false }
+      its(:release?) { should be_truthy }
+      its(:prerelease?) { should be_falsey }
+      its(:build?) { should be_falsey }
+      its(:release_build?) { should be_falsey }
+      its(:prerelease_build?) { should be_falsey }
     end
 
     context 'pre-release version' do
       let(:version_string) { '1.0.0-alpha.1' }
-      its(:release?) { should be_false }
-      its(:prerelease?) { should be_true }
-      its(:build?) { should be_false }
-      its(:release_build?) { should be_false }
-      its(:prerelease_build?) { should be_false }
+      its(:release?) { should be_falsey }
+      its(:prerelease?) { should be_truthy }
+      its(:build?) { should be_falsey }
+      its(:release_build?) { should be_falsey }
+      its(:prerelease_build?) { should be_falsey }
     end
 
     context 'pre-release build version' do
       let(:version_string) { '1.0.0-alpha.1+20130308110833' }
-      its(:release?) { should be_false }
-      its(:prerelease?) { should be_false }
-      its(:build?) { should be_true }
-      its(:release_build?) { should be_false }
-      its(:prerelease_build?) { should be_true }
+      its(:release?) { should be_falsey }
+      its(:prerelease?) { should be_falsey }
+      its(:build?) { should be_truthy }
+      its(:release_build?) { should be_falsey }
+      its(:prerelease_build?) { should be_truthy }
     end
 
     context 'release build version' do
       let(:version_string) { '1.0.0+20130308110833' }
-      its(:release?) { should be_false }
-      its(:prerelease?) { should be_false }
-      its(:build?) { should be_true }
-      its(:release_build?) { should be_true }
-      its(:prerelease_build?) { should be_false }
+      its(:release?) { should be_falsey }
+      its(:prerelease?) { should be_falsey }
+      its(:build?) { should be_truthy }
+      its(:release_build?) { should be_truthy }
+      its(:prerelease_build?) { should be_falsey }
     end
   end
 end