Skip to content

Commit 5b6f8e1

Browse files
committed
Fix unnecessary formatting quirks in various tests
1 parent c02733f commit 5b6f8e1

11 files changed

+129
-130
lines changed

spec/integration/rspec/be_predicate_matcher_spec.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# rubocop:enable Metrics/BlockLength
88
context "using #{prefix}_<predicate>" do
99
context "when the predicate method doesn't exist on the object" do
10-
context "when the inspected version of the actual value is short" do
10+
context "when the inspected version of the actual value is short" do
1111
it "produces the correct failure message" do
1212
as_both_colored_and_uncolored do |color_enabled|
1313
snippet = %|expect(:foo).to #{prefix}_strong|
@@ -39,7 +39,7 @@
3939
end
4040
end
4141

42-
context "when the inspected version of the actual value is long" do
42+
context "when the inspected version of the actual value is long" do
4343
it "produces the correct failure message" do
4444
as_both_colored_and_uncolored do |color_enabled|
4545
snippet = <<~TEST.strip
@@ -80,7 +80,7 @@
8080

8181
context "when the predicate method exists on the object" do
8282
context "but is private" do
83-
context "when the inspected version of the actual value is short" do
83+
context "when the inspected version of the actual value is short" do
8484
it "produces the correct failure message" do
8585
as_both_colored_and_uncolored do |color_enabled|
8686
snippet = <<~TEST.strip
@@ -118,7 +118,7 @@ class Foo
118118
end
119119
end
120120

121-
context "when the inspected version of the actual value is long" do
121+
context "when the inspected version of the actual value is long" do
122122
it "produces the correct failure message" do
123123
as_both_colored_and_uncolored do |color_enabled|
124124
snippet = <<~TEST.strip
@@ -165,7 +165,7 @@ class << hash
165165
context "and is public" do
166166
context "and returns false" do
167167
context "but is called #true?" do
168-
context "when the inspected version of the actual value is short" do
168+
context "when the inspected version of the actual value is short" do
169169
it "produces the correct failure message" do
170170
as_both_colored_and_uncolored do |color_enabled|
171171
snippet = <<~TEST.strip
@@ -217,7 +217,7 @@ def true?; false; end
217217
end
218218
end
219219

220-
context "when the inspected version of the actual value is long" do
220+
context "when the inspected version of the actual value is long" do
221221
it "produces the correct failure message" do
222222
as_both_colored_and_uncolored do |color_enabled|
223223
snippet = <<~TEST.strip
@@ -323,7 +323,7 @@ def false?; false; end
323323

324324
context "and is called neither #true? nor #false?" do
325325
context "and is singular" do
326-
context "when the inspected version of the actual value is short" do
326+
context "when the inspected version of the actual value is short" do
327327
it "produces the correct failure message" do
328328
as_both_colored_and_uncolored do |color_enabled|
329329
snippet = <<~TEST.strip
@@ -364,7 +364,7 @@ def y?; false; end
364364
end
365365
end
366366

367-
context "when the inspected version of the actual value is long" do
367+
context "when the inspected version of the actual value is long" do
368368
it "produces the correct failure message" do
369369
as_both_colored_and_uncolored do |color_enabled|
370370
snippet = <<~TEST.strip
@@ -418,7 +418,7 @@ def y?; false; end
418418
end
419419

420420
context "and is plural" do
421-
context "when the inspected version of the actual value is short" do
421+
context "when the inspected version of the actual value is short" do
422422
it "produces the correct failure message" do
423423
as_both_colored_and_uncolored do |color_enabled|
424424
snippet = <<~TEST.strip
@@ -459,7 +459,7 @@ def ys?; false; end
459459
end
460460
end
461461

462-
context "when the inspected version of the actual value is long" do
462+
context "when the inspected version of the actual value is long" do
463463
it "produces the correct failure message" do
464464
as_both_colored_and_uncolored do |color_enabled|
465465
snippet = <<~TEST.strip
@@ -515,7 +515,7 @@ def ys?; false; end
515515
end
516516

517517
context "and returns true" do
518-
context "when the inspected version of the actual value is short" do
518+
context "when the inspected version of the actual value is short" do
519519
it "produces the correct failure message when used in the negative" do
520520
as_both_colored_and_uncolored do |color_enabled|
521521
snippet = <<~TEST.strip
@@ -556,7 +556,7 @@ def strong?; true; end
556556
end
557557
end
558558

559-
context "when the inspected version of the actual value is long" do
559+
context "when the inspected version of the actual value is long" do
560560
it "produces the correct failure message when used in the negative" do
561561
as_both_colored_and_uncolored do |color_enabled|
562562
snippet = <<~TEST.strip

spec/integration/rspec/contain_exactly_matcher_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
as_both_colored_and_uncolored do |color_enabled|
88
snippet = <<~TEST.strip
99
expected = ["Einie", "Marty"]
10-
actual = ["Marty", "Jennifer", "Doc"]
10+
actual = ["Marty", "Jennifer", "Doc"]
1111
expect(actual).to contain_exactly(*expected)
1212
TEST
1313
program = make_plain_test_program(snippet, color_enabled: color_enabled)
@@ -91,7 +91,7 @@
9191
"George McFly",
9292
"Lorraine McFly"
9393
]
94-
actual = [
94+
actual = [
9595
"Marty McFly",
9696
"Doc Brown",
9797
"Einie",
@@ -203,7 +203,7 @@
203203
/Georg McFly/,
204204
/Lorrain McFly/
205205
]
206-
actual = [
206+
actual = [
207207
"Marty McFly",
208208
"Doc Brown",
209209
"Einie",
@@ -317,7 +317,7 @@
317317
a_collection_containing_exactly("zing"),
318318
an_object_having_attributes(baz: "qux"),
319319
]
320-
actual = [
320+
actual = [
321321
{ foo: "bar" },
322322
double(baz: "qux"),
323323
{ blargh: "riddle" }

spec/integration/rspec/eq_matcher_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
as_both_colored_and_uncolored do |color_enabled|
175175
snippet = <<~RUBY
176176
expected = Time.utc(2011, 12, 13, 14, 15, 16)
177-
actual = Time.utc(2011, 12, 13, 14, 15, 16, 500_000)
177+
actual = Time.utc(2011, 12, 13, 14, 15, 16, 500_000)
178178
expect(expected).to eq(actual)
179179
RUBY
180180
program = make_plain_test_program(snippet, color_enabled: color_enabled)
@@ -257,7 +257,7 @@
257257
as_both_colored_and_uncolored do |color_enabled|
258258
snippet = <<~TEST.strip
259259
expected = "Something entirely different"
260-
actual = "This is a line\\nAnd that's another line\\n"
260+
actual = "This is a line\\nAnd that's another line\\n"
261261
expect(actual).to eq(expected)
262262
TEST
263263
program = make_plain_test_program(snippet, color_enabled: color_enabled)
@@ -296,7 +296,7 @@
296296
as_both_colored_and_uncolored do |color_enabled|
297297
snippet = <<~TEST.strip
298298
expected = "This is a line\\nAnd that's another line\\n"
299-
actual = "Something entirely different"
299+
actual = "Something entirely different"
300300
expect(actual).to eq(expected)
301301
TEST
302302
program = make_plain_test_program(snippet, color_enabled: color_enabled)
@@ -335,7 +335,7 @@
335335
as_both_colored_and_uncolored do |color_enabled|
336336
snippet = <<~TEST.strip
337337
expected = "This is a line\\nAnd that's a line\\nAnd there's a line too\\n"
338-
actual = "This is a line\\nSomething completely different\\nAnd there's a line too\\n"
338+
actual = "This is a line\\nSomething completely different\\nAnd there's a line too\\n"
339339
expect(actual).to eq(expected)
340340
TEST
341341
program = make_plain_test_program(snippet, color_enabled: color_enabled)
@@ -422,7 +422,7 @@
422422
}
423423
]
424424
]
425-
actual = [
425+
actual = [
426426
[
427427
:h2,
428428
[:span, [:text, "Goodbye world"]],
@@ -567,7 +567,7 @@
567567
{ name: "Chevy 4x4" }
568568
]
569569
}
570-
actual = {
570+
actual = {
571571
customer: {
572572
person: SuperDiff::Test::Person.new(name: "Marty McFly, Jr.", age: 17),
573573
shipping_address: {
@@ -708,7 +708,7 @@
708708
name: "Marty",
709709
age: 31,
710710
)
711-
actual = SuperDiff::Test::Customer.new(
711+
actual = SuperDiff::Test::Customer.new(
712712
name: "Doc",
713713
shipping_address: :some_shipping_address,
714714
phone: "1234567890",
@@ -787,7 +787,7 @@
787787
name: "camera",
788788
quantity: 3,
789789
)
790-
actual = SuperDiff::Test::Player.new(
790+
actual = SuperDiff::Test::Player.new(
791791
handle: "mcmire",
792792
character: "Jon",
793793
inventory: ["sword"],
@@ -866,7 +866,7 @@
866866
as_both_colored_and_uncolored do |color_enabled|
867867
snippet = <<~TEST.strip
868868
expected = { foo: nil }
869-
actual = { foo: [] }
869+
actual = { foo: [] }
870870
expect(actual).to eq(expected)
871871
TEST
872872
program = make_plain_test_program(snippet, color_enabled: color_enabled)
@@ -907,7 +907,7 @@
907907
as_both_colored_and_uncolored do |color_enabled|
908908
snippet = <<~TEST.strip
909909
expected = { foo: nil }
910-
actual = { foo: {} }
910+
actual = { foo: {} }
911911
expect(actual).to eq(expected)
912912
TEST
913913
program = make_plain_test_program(snippet, color_enabled: color_enabled)
@@ -948,7 +948,7 @@
948948
as_both_colored_and_uncolored do |color_enabled|
949949
snippet = <<~TEST.strip
950950
expected = { foo: nil }
951-
actual = { foo: SuperDiff::Test::EmptyClass.new }
951+
actual = { foo: SuperDiff::Test::EmptyClass.new }
952952
expect(actual).to eq(expected)
953953
TEST
954954
program = make_plain_test_program(snippet, color_enabled: color_enabled)

spec/integration/rspec/have_attributes_matcher_spec.rb

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
RSpec.describe "Integration with RSpec's #have_attributes matcher",
44
type: :integration do
5-
context "when the actual value is an object" do
5+
context "when the actual value is an object" do
66
context "with a small set of attributes" do
7-
context "when all of the names are methods on the actual object" do
7+
context "when all of the names are methods on the actual object" do
88
it "produces the correct output when used in the positive" do
99
as_both_colored_and_uncolored do |color_enabled|
1010
snippet = <<~TEST.strip
1111
expected = { name: "b" }
12-
actual = SuperDiff::Test::Person.new(name: "a", age: 9)
12+
actual = SuperDiff::Test::Person.new(name: "a", age: 9)
1313
expect(actual).to have_attributes(expected)
1414
TEST
1515
program =
@@ -50,7 +50,7 @@
5050
as_both_colored_and_uncolored do |color_enabled|
5151
snippet = <<~TEST.strip
5252
expected = { name: "a" }
53-
actual = SuperDiff::Test::Person.new(name: "a", age: 9)
53+
actual = SuperDiff::Test::Person.new(name: "a", age: 9)
5454
expect(actual).not_to have_attributes(expected)
5555
TEST
5656
program =
@@ -79,12 +79,12 @@
7979
end
8080
end
8181

82-
context "when some of the names are not methods on the actual object" do
82+
context "when some of the names are not methods on the actual object" do
8383
it "produces the correct output" do
8484
as_both_colored_and_uncolored do |color_enabled|
8585
snippet = <<~TEST.strip
8686
expected = { name: "b", foo: "bar" }
87-
actual = SuperDiff::Test::Person.new(name: "a", age: 9)
87+
actual = SuperDiff::Test::Person.new(name: "a", age: 9)
8888
expect(actual).to have_attributes(expected)
8989
TEST
9090
program =
@@ -127,7 +127,7 @@
127127
end
128128

129129
context "with a large set of attributes" do
130-
context "when all of the names are methods on the actual object" do
130+
context "when all of the names are methods on the actual object" do
131131
it "produces the correct output when used in the positive" do
132132
as_both_colored_and_uncolored do |color_enabled|
133133
snippet = <<~TEST.strip
@@ -137,7 +137,7 @@
137137
state: "CA",
138138
zip: "91234"
139139
}
140-
actual = SuperDiff::Test::ShippingAddress.new(
140+
actual = SuperDiff::Test::ShippingAddress.new(
141141
line_1: "456 Ponderosa Ct.",
142142
line_2: nil,
143143
city: "Hill Valley",
@@ -195,7 +195,7 @@
195195
state: "CA",
196196
zip: "91234"
197197
}
198-
actual = SuperDiff::Test::ShippingAddress.new(
198+
actual = SuperDiff::Test::ShippingAddress.new(
199199
line_1: "123 Main St.",
200200
line_2: nil,
201201
city: "Oakland",
@@ -233,7 +233,7 @@
233233
end
234234
end
235235

236-
context "when some of the names are not methods on the actual object" do
236+
context "when some of the names are not methods on the actual object" do
237237
it "produces the correct output" do
238238
as_both_colored_and_uncolored do |color_enabled|
239239
snippet = <<~TEST.strip
@@ -245,7 +245,7 @@
245245
foo: "bar",
246246
baz: "qux"
247247
}
248-
actual = SuperDiff::Test::ShippingAddress.new(
248+
actual = SuperDiff::Test::ShippingAddress.new(
249249
line_1: "456 Ponderosa Ct.",
250250
line_2: nil,
251251
city: "Hill Valley",
@@ -303,12 +303,12 @@
303303
end
304304
end
305305

306-
context "when the actual value is actually a hash instead of an object" do
306+
context "when the actual value is actually a hash instead of an object" do
307307
it "displays the diff as if we were comparing hashes" do
308308
as_both_colored_and_uncolored do |color_enabled|
309309
snippet = <<~TEST.strip
310310
expected = { name: "Elliot", age: 32 }
311-
actual = {}
311+
actual = {}
312312
expect(actual).to have_attributes(expected)
313313
TEST
314314

@@ -365,8 +365,7 @@
365365
data: a_hash_including(active: true),
366366
created_at: a_value_within(1).of(Time.utc(2020, 4, 9))
367367
}
368-
369-
actual = {}
368+
actual = {}
370369
371370
expect(actual).to have_attributes(expected)
372371
TEST

0 commit comments

Comments
 (0)