about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorAdam Copp <adam.copp@gmail.com>2018-12-11 04:30:57 +0000
committerEugen Rochko <eugen@zeonfederated.com>2018-12-11 05:30:57 +0100
commit7d00e4edbd0bef8791d8efee7665eb13bb256d7a (patch)
tree1946b862acc6b02b3fbaf670690f196f81f74ea5 /spec/models
parentdbb1ee269fa4a6ee097dfea5f77bb2c9428af93b (diff)
Make custom emoji domains case insensitive #9351 (#9474)
* Make custom emoji domains case sensitive #9351

* Fixup style in downcase_domain to comply with codeclimate.

* switch if! to unless

* Don't use transactions, operate in batches.

Also revert spurious schema change.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/custom_emoji_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/custom_emoji_spec.rb b/spec/models/custom_emoji_spec.rb
index 320a258d3..9de218b4f 100644
--- a/spec/models/custom_emoji_spec.rb
+++ b/spec/models/custom_emoji_spec.rb
@@ -75,4 +75,13 @@ RSpec.describe CustomEmoji, type: :model do
       end
     end
   end
+
+  describe 'pre_validation' do
+    let(:custom_emoji) { Fabricate(:custom_emoji, domain: 'wWw.MaStOdOn.CoM') }
+
+    it 'should downcase' do
+      custom_emoji.valid?
+      expect(custom_emoji.domain).to eq('www.mastodon.com')
+    end
+  end
 end