Skip to content

Commit 24fc402

Browse files
Change "taken" error message text to match I18n/ActiveRecord (#5275)
Co-authored-by: shields <[email protected]>
1 parent b1c3718 commit 24fc402

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

lib/config/locales/en.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ en:
540540
resolution: "Verify that all servers in your deployment are at least
541541
version 3.6 or don't attempt to use sessions with older server versions."
542542
taken:
543-
"is already taken"
543+
"has already been taken"
544544
too_many_nested_attribute_records:
545545
message: "Accepting nested attributes for %{association} is limited
546546
to %{limit} records."

spec/mongoid/validatable/uniqueness_spec.rb

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
it "adds the uniqueness error to the aliased field name" do
121121
dictionary.valid?
122122
expect(dictionary.errors).to have_key(:language)
123-
expect(dictionary.errors[:language]).to eq([ "is already taken" ])
123+
expect(dictionary.errors[:language]).to eq([ "has already been taken" ])
124124
end
125125
end
126126

@@ -137,7 +137,7 @@
137137
it "adds the uniqueness error to the underlying field name" do
138138
dictionary.valid?
139139
expect(dictionary.errors).to have_key(:l)
140-
expect(dictionary.errors[:l]).to eq([ "is already taken" ])
140+
expect(dictionary.errors[:l]).to eq([ "has already been taken" ])
141141
end
142142
end
143143
end
@@ -239,7 +239,7 @@
239239

240240
it "adds the uniqueness error" do
241241
dictionary.valid?
242-
expect(dictionary.errors[:description]).to eq([ "is already taken" ])
242+
expect(dictionary.errors[:description]).to eq([ "has already been taken" ])
243243
end
244244
end
245245

@@ -260,7 +260,7 @@
260260

261261
it "adds the uniqueness error" do
262262
dictionary.valid?
263-
expect(dictionary.errors[:description]).to eq([ "is already taken" ])
263+
expect(dictionary.errors[:description]).to eq([ "has already been taken" ])
264264
end
265265
end
266266
end
@@ -330,7 +330,7 @@
330330

331331
it "adds the uniqueness error" do
332332
dictionary.valid?
333-
expect(dictionary.errors[:description]).to eq([ "is already taken" ])
333+
expect(dictionary.errors[:description]).to eq([ "has already been taken" ])
334334
end
335335
end
336336

@@ -351,7 +351,7 @@
351351

352352
it "adds the uniqueness error" do
353353
dictionary.valid?
354-
expect(dictionary.errors[:description]).to eq([ "is already taken" ])
354+
expect(dictionary.errors[:description]).to eq([ "has already been taken" ])
355355
end
356356
end
357357
end
@@ -399,7 +399,7 @@
399399

400400
it "adds the uniqueness error" do
401401
dictionary.valid?
402-
expect(dictionary.errors[:description]).to eq([ "is already taken" ])
402+
expect(dictionary.errors[:description]).to eq([ "has already been taken" ])
403403
end
404404
end
405405
end
@@ -460,7 +460,7 @@
460460

461461
it "adds the uniqueness error" do
462462
dictionary.valid?
463-
expect(dictionary.errors[:name]).to eq([ "is already taken" ])
463+
expect(dictionary.errors[:name]).to eq([ "has already been taken" ])
464464
end
465465
end
466466

@@ -623,7 +623,7 @@
623623

624624
it "adds the uniqueness errors" do
625625
dictionary.valid?
626-
expect(dictionary.errors[:name]).to eq([ "is already taken" ])
626+
expect(dictionary.errors[:name]).to eq([ "has already been taken" ])
627627
end
628628
end
629629

@@ -701,7 +701,7 @@
701701

702702
it "should set an error for associated object not being unique" do
703703
item.update_attributes(folder_id: personal_folder.id)
704-
expect(item.errors.messages[:name].first).to eq("is already taken")
704+
expect(item.errors.messages[:name].first).to eq("has already been taken")
705705
end
706706
end
707707

@@ -753,7 +753,7 @@
753753

754754
it "adds the uniqueness errors" do
755755
dictionary.valid?
756-
expect(dictionary.errors[:name]).to eq([ "is already taken" ])
756+
expect(dictionary.errors[:name]).to eq([ "has already been taken" ])
757757
end
758758
end
759759

@@ -792,7 +792,7 @@
792792

793793
it "adds the uniqueness errors" do
794794
dictionary.valid?
795-
expect(dictionary.errors[:name]).to eq([ "is already taken" ])
795+
expect(dictionary.errors[:name]).to eq([ "has already been taken" ])
796796
end
797797
end
798798
end
@@ -815,7 +815,7 @@
815815

816816
expect do
817817
Dictionary.create!(name: "French-English", year: 1960)
818-
end.to raise_error(Mongoid::Errors::Validations, /Name is already taken/)
818+
end.to raise_error(Mongoid::Errors::Validations, /Name has already been taken/)
819819

820820
expect(Dictionary.all.size).to eq(1)
821821
end
@@ -954,7 +954,7 @@
954954

955955
it "adds the uniqueness errors" do
956956
dictionary.valid?
957-
expect(dictionary.errors[:name]).to eq([ "is already taken" ])
957+
expect(dictionary.errors[:name]).to eq([ "has already been taken" ])
958958
end
959959
end
960960

@@ -1018,7 +1018,7 @@
10181018

10191019
it "adds the uniqueness error" do
10201020
dictionary.valid?
1021-
expect(dictionary.errors[:name]).to eq([ "is already taken" ])
1021+
expect(dictionary.errors[:name]).to eq([ "has already been taken" ])
10221022
end
10231023
end
10241024

@@ -1096,7 +1096,7 @@
10961096

10971097
it "adds the uniqueness error" do
10981098
dictionary.valid?
1099-
expect(dictionary.errors[:name]).to eq([ "is already taken" ])
1099+
expect(dictionary.errors[:name]).to eq([ "has already been taken" ])
11001100
end
11011101
end
11021102

@@ -1218,7 +1218,7 @@
12181218

12191219
it "adds the uniqueness error" do
12201220
login.valid?
1221-
expect(login.errors[:username]).to eq([ "is already taken" ])
1221+
expect(login.errors[:username]).to eq([ "has already been taken" ])
12221222
end
12231223
end
12241224

@@ -1323,7 +1323,7 @@
13231323

13241324
it "adds the uniqueness errors" do
13251325
login.valid?
1326-
expect(login.errors[:username]).to eq([ "is already taken" ])
1326+
expect(login.errors[:username]).to eq([ "has already been taken" ])
13271327
end
13281328
end
13291329

@@ -1383,7 +1383,7 @@
13831383

13841384
it "adds the uniqueness error" do
13851385
login.valid?
1386-
expect(login.errors[:username]).to eq([ "is already taken" ])
1386+
expect(login.errors[:username]).to eq([ "has already been taken" ])
13871387
end
13881388
end
13891389

@@ -1461,7 +1461,7 @@
14611461

14621462
it "adds the uniqueness error" do
14631463
login.valid?
1464-
expect(login.errors[:username]).to eq([ "is already taken" ])
1464+
expect(login.errors[:username]).to eq([ "has already been taken" ])
14651465
end
14661466
end
14671467

@@ -1710,7 +1710,7 @@
17101710

17111711
it "adds the uniqueness error" do
17121712
definition.valid?
1713-
expect(definition.errors[:description]).to eq([ "is already taken" ])
1713+
expect(definition.errors[:description]).to eq([ "has already been taken" ])
17141714
end
17151715
end
17161716

@@ -1838,7 +1838,7 @@
18381838

18391839
it "adds the uniqueness errors" do
18401840
definition.valid?
1841-
expect(definition.errors[:description]).to eq([ "is already taken" ])
1841+
expect(definition.errors[:description]).to eq([ "has already been taken" ])
18421842
end
18431843
end
18441844

@@ -1976,7 +1976,7 @@
19761976

19771977
it "adds the uniqueness errors" do
19781978
definition.valid?
1979-
expect(definition.errors[:description]).to eq([ "is already taken" ])
1979+
expect(definition.errors[:description]).to eq([ "has already been taken" ])
19801980
end
19811981
end
19821982

@@ -2040,7 +2040,7 @@
20402040

20412041
it "adds the uniqueness error" do
20422042
definition.valid?
2043-
expect(definition.errors[:description]).to eq([ "is already taken" ])
2043+
expect(definition.errors[:description]).to eq([ "has already been taken" ])
20442044
end
20452045
end
20462046

@@ -2118,7 +2118,7 @@
21182118

21192119
it "adds the uniqueness error" do
21202120
definition.valid?
2121-
expect(definition.errors[:description]).to eq([ "is already taken" ])
2121+
expect(definition.errors[:description]).to eq([ "has already been taken" ])
21222122
end
21232123
end
21242124

@@ -2214,7 +2214,7 @@
22142214
it "adds the uniqueness error to the aliased field name" do
22152215
definition.valid?
22162216
expect(definition.errors).to have_key(:part)
2217-
expect(definition.errors[:part]).to eq([ "is already taken" ])
2217+
expect(definition.errors[:part]).to eq([ "has already been taken" ])
22182218
end
22192219
end
22202220

@@ -2231,7 +2231,7 @@
22312231
it "adds the uniqueness error to the underlying field name" do
22322232
definition.valid?
22332233
expect(definition.errors).to have_key(:p)
2234-
expect(definition.errors[:p]).to eq([ "is already taken" ])
2234+
expect(definition.errors[:p]).to eq([ "has already been taken" ])
22352235
end
22362236
end
22372237

@@ -2250,7 +2250,7 @@
22502250
it "adds the uniqueness error to the aliased field name" do
22512251
definition.valid?
22522252
expect(definition.errors).to have_key(:synonyms)
2253-
expect(definition.errors[:synonyms]).to eq([ "is already taken" ])
2253+
expect(definition.errors[:synonyms]).to eq([ "has already been taken" ])
22542254
end
22552255
end
22562256

@@ -2267,7 +2267,7 @@
22672267
it "adds the uniqueness error to the aliased field name" do
22682268
definition.valid?
22692269
expect(definition.errors).to have_key(:syn)
2270-
expect(definition.errors[:syn]).to eq([ "is already taken" ])
2270+
expect(definition.errors[:syn]).to eq([ "has already been taken" ])
22712271
end
22722272
end
22732273
end
@@ -2319,7 +2319,7 @@
23192319

23202320
it "adds the uniqueness error" do
23212321
word_origin.valid?
2322-
expect(word_origin.errors[:origin_id]).to eq([ "is already taken" ])
2322+
expect(word_origin.errors[:origin_id]).to eq([ "has already been taken" ])
23232323
end
23242324
end
23252325

@@ -2444,7 +2444,7 @@ class SpanishActor < EuropeanActor
24442444
it "should be invalid" do
24452445
subclass_document_with_duplicated_name.tap do |d|
24462446
expect(d).to be_invalid
2447-
expect(d.errors[:name]).to eq([ "is already taken" ])
2447+
expect(d.errors[:name]).to eq([ "has already been taken" ])
24482448
end
24492449
end
24502450
end

0 commit comments

Comments
 (0)