From 9932bea7ce449b685959d6c2df10b5965fddb772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 25 Dec 2014 17:58:15 +0100 Subject: [PATCH] FEATURE: default emoji override --- app/controllers/admin/emojis_controller.rb | 2 +- spec/controllers/admin/emojis_controller_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/emojis_controller.rb b/app/controllers/admin/emojis_controller.rb index 9354a3bb4..ea230f122 100644 --- a/app/controllers/admin/emojis_controller.rb +++ b/app/controllers/admin/emojis_controller.rb @@ -14,7 +14,7 @@ class Admin::EmojisController < Admin::AdminController .downcase # check the name doesn't already exist - if Emoji.all.detect { |e| e.name == name } + if Emoji.custom.detect { |e| e.name == name } render json: failed_json.merge(message: I18n.t("emoji.errors.name_already_exists", name: name)), status: 422 else if emoji = Emoji.create_for(file, name) diff --git a/spec/controllers/admin/emojis_controller_spec.rb b/spec/controllers/admin/emojis_controller_spec.rb index 43293cf51..9aa79c44d 100644 --- a/spec/controllers/admin/emojis_controller_spec.rb +++ b/spec/controllers/admin/emojis_controller_spec.rb @@ -29,7 +29,7 @@ describe Admin::EmojisController do context '.create' do - before { Emoji.expects(:all).returns([custom_emoji]) } + before { Emoji.expects(:custom).returns([custom_emoji]) } context 'name already exist' do it "throws an error" do