File: rspec3.patch

package info (click to toggle)
ruby-semverse 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 216 kB
  • sloc: ruby: 1,146; makefile: 3
file content (258 lines) | stat: -rw-r--r-- 8,208 bytes parent folder | download | duplicates (4)
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
From 40277eb4ede44355fc52dfbd810e613ef25c35ce Mon Sep 17 00:00:00 2001
From: Larry Gilbert <larry@l2g.to>
Date: Thu, 13 Nov 2014 11:04:10 -0800
Subject: [PATCH 1/7] Require rspec ~> 2.99
Bug: https://patch-diff.githubusercontent.com/raw/berkshelf/semverse/pull/5.patch

Tests break in newer versions of RSpec due to deprecated usage.
---
 Gemfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Gemfile b/Gemfile
index 205cedc..1ec7d22 100644
--- a/Gemfile
+++ b/Gemfile
@@ -25,5 +25,5 @@ end
 group :test do
   gem "spork"
   gem "rake"
-  gem "rspec"
+  gem "rspec", "~> 2.99"
 end

From d4437e37be6479f8417a76638a65ff063f09ef50 Mon Sep 17 00:00:00 2001
From: Larry Gilbert <larry@l2g.to>
Date: Thu, 13 Nov 2014 11:11:12 -0800
Subject: [PATCH 2/7] Rewrite defunct 'have' matchers

---
 spec/unit/semverse/version_spec.rb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/spec/unit/semverse/version_spec.rb b/spec/unit/semverse/version_spec.rb
index 11c611d..411d512 100644
--- a/spec/unit/semverse/version_spec.rb
+++ b/spec/unit/semverse/version_spec.rb
@@ -224,12 +224,12 @@
 
     describe "::split" do
       it "returns an array containing 5 elements" do
-        expect(subject.split("1.2.0-alpha.1")).to have(5).items
+        expect(subject.split("1.2.0-alpha.1").size).to eq(5)
       end
 
       context "given a string only containing a major, minor and patch version" do
         it "returns an array containing 4 elements" do
-          expect(subject.split("1.2.3")).to have(5).items
+          expect(subject.split("1.2.3").size).to eq(5)
         end
 
         it "returns nil as fourth element" do
@@ -243,7 +243,7 @@
 
       context "given a string only containing a major and minor version" do
         it "returns an array containing 4 elements" do
-          expect(subject.split("1.2")).to have(3).items
+          expect(subject.split("1.2").size).to eq(3)
         end
 
         it "returns 0 as the third element" do
@@ -257,7 +257,7 @@
 
       context "given a string with only a major version" do
         it "returns an array containing 3 elements" do
-          expect(subject.split("1")).to have(3).items
+          expect(subject.split("1").size).to eq(3)
         end
 
         it "returns 0 as the second element" do

From 3681573bcebb60d69a115d76790ac800e8a00648 Mon Sep 17 00:00:00 2001
From: Larry Gilbert <larry@l2g.to>
Date: Thu, 13 Nov 2014 11:08:58 -0800
Subject: [PATCH 3/7] Change "be_true" expectations to "be true"

---
 spec/unit/semverse/constraint_spec.rb | 2 +-
 spec/unit/semverse/version_spec.rb    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/spec/unit/semverse/constraint_spec.rb b/spec/unit/semverse/constraint_spec.rb
index a0c1c0e..9f37e6c 100644
--- a/spec/unit/semverse/constraint_spec.rb
+++ b/spec/unit/semverse/constraint_spec.rb
@@ -2,7 +2,7 @@
 
 RSpec::Matchers.define :satisfies do |*args|
   match do |constraint|
-    constraint.satisfies?(*args).should be_true
+    constraint.satisfies?(*args).should be true
   end
 end
 
diff --git a/spec/unit/semverse/version_spec.rb b/spec/unit/semverse/version_spec.rb
index 411d512..f5dac74 100644
--- a/spec/unit/semverse/version_spec.rb
+++ b/spec/unit/semverse/version_spec.rb
@@ -300,7 +300,7 @@
   describe "#pre_release?" do
     context "when a pre-release value is set" do
       subject { described_class.new("1.2.3-alpha").pre_release? }
-      it { should be_true }
+      it { should be true }
     end
 
     context "when no pre-release value is set" do
@@ -312,7 +312,7 @@
   describe "#zero?" do
     context "major, minor and patch are equal to 0" do
       subject { described_class.new("0.0.0").zero? }
-      it { should be_true }
+      it { should be true }
     end
 
     context "major is not equal to 0" do

From d886fc8121d1bec92b10e2b48949ed67c4386899 Mon Sep 17 00:00:00 2001
From: Larry Gilbert <larry@l2g.to>
Date: Thu, 13 Nov 2014 11:13:11 -0800
Subject: [PATCH 4/7] Change "be_false" matcher syntax to "be false"

---
 spec/unit/semverse/version_spec.rb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/spec/unit/semverse/version_spec.rb b/spec/unit/semverse/version_spec.rb
index f5dac74..c969501 100644
--- a/spec/unit/semverse/version_spec.rb
+++ b/spec/unit/semverse/version_spec.rb
@@ -305,7 +305,7 @@
 
     context "when no pre-release value is set" do
       subject { described_class.new("1.2.3").pre_release? }
-      it { should be_false }
+      it { should be false }
     end
   end
 
@@ -317,17 +317,17 @@
 
     context "major is not equal to 0" do
       subject { described_class.new("1.0.0").zero? }
-      it { should be_false }
+      it { should be false }
     end
 
     context "minor is not equal to 0" do
       subject { described_class.new("0.1.0").zero? }
-      it { should be_false }
+      it { should be false }
     end
 
     context "patch is not equal to 0" do
       subject { described_class.new("0.0.1").zero? }
-      it { should be_false }
+      it { should be false }
     end
   end
 

From 02ba7bf84debcd0b51248c144281b0599b19ac8c Mon Sep 17 00:00:00 2001
From: Larry Gilbert <larry@l2g.to>
Date: Thu, 13 Nov 2014 11:19:21 -0800
Subject: [PATCH 5/7] Require rspec ~> 3.0

---
 Gemfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Gemfile b/Gemfile
index 1ec7d22..48e8b89 100644
--- a/Gemfile
+++ b/Gemfile
@@ -25,5 +25,5 @@ end
 group :test do
   gem "spork"
   gem "rake"
-  gem "rspec", "~> 2.99"
+  gem "rspec", "~> 3.0"
 end

From 5a42606d249b4d0b6abb5161557465ac10438460 Mon Sep 17 00:00:00 2001
From: Larry Gilbert <larry@l2g.to>
Date: Thu, 13 Nov 2014 11:17:46 -0800
Subject: [PATCH 6/7] Remove deprecated
 "treat_symbols_as_metadata_keys_with_true_values"

This was set to true, which is now the default with RSpec 3.
---
 spec/spec_helper.rb | 1 -
 1 file changed, 1 deletion(-)

diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 80b2358..04c58c1 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -11,7 +11,6 @@
 
   RSpec.configure do |config|
     config.mock_with :rspec
-    config.treat_symbols_as_metadata_keys_with_true_values = true
     config.filter_run focus: true
     config.run_all_when_everything_filtered = true
 

From ed82effdbb8e8821faffd5d7464f91296275314a Mon Sep 17 00:00:00 2001
From: Larry Gilbert <larry@l2g.to>
Date: Thu, 13 Nov 2014 12:03:45 -0800
Subject: [PATCH 7/7] Change "should" syntax to "expect" style

This just changes the "shoulds" that raise deprecation warnings.
---
 spec/unit/semverse/constraint_spec.rb | 2 +-
 spec/unit/semverse/version_spec.rb    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/spec/unit/semverse/constraint_spec.rb b/spec/unit/semverse/constraint_spec.rb
index 9f37e6c..eb7e7b6 100644
--- a/spec/unit/semverse/constraint_spec.rb
+++ b/spec/unit/semverse/constraint_spec.rb
@@ -2,7 +2,7 @@
 
 RSpec::Matchers.define :satisfies do |*args|
   match do |constraint|
-    constraint.satisfies?(*args).should be true
+    expect(constraint.satisfies?(*args)).to be true
   end
 end
 
diff --git a/spec/unit/semverse/version_spec.rb b/spec/unit/semverse/version_spec.rb
index c969501..a580abe 100644
--- a/spec/unit/semverse/version_spec.rb
+++ b/spec/unit/semverse/version_spec.rb
@@ -284,13 +284,13 @@
     describe "::coerce" do
 
       it "coerces a String to a Version object" do
-        subject.coerce("1.0.0").should eql(subject.new("1.0.0"))
+        expect(subject.coerce("1.0.0")).to eql(subject.new("1.0.0"))
       end
 
       it "returns an object of the desired class without any additional processing" do
         version = subject.new("1.0.0")
         # we want object equality here to prove that the exact object was returned
-        subject.coerce(version).should equal(version)
+        expect(subject.coerce(version)).to equal(version)
       end
 
     end
@@ -335,7 +335,7 @@
     subject { Semverse::Version.new("1.0.0-rc.1+build.1") }
 
     it "returns a string containing the major.minor.patch-pre_release+build" do
-      subject.to_s.should eq("1.0.0-rc.1+build.1")
+      expect(subject.to_s).to eq("1.0.0-rc.1+build.1")
     end
   end