]> cat aescling's git repositories - mastodon.git/commitdiff
Add a test for emojis_controller (#7652)
authorShuhei Kitagawa <shuheiktgw@users.noreply.github.com>
Mon, 28 May 2018 13:56:58 +0000 (22:56 +0900)
committerYamagishi Kazutoshi <ykzts@desire.sh>
Mon, 28 May 2018 13:56:58 +0000 (22:56 +0900)
spec/controllers/emojis_controller_spec.rb [new file with mode: 0644]

diff --git a/spec/controllers/emojis_controller_spec.rb b/spec/controllers/emojis_controller_spec.rb
new file mode 100644 (file)
index 0000000..68bae25
--- /dev/null
@@ -0,0 +1,17 @@
+require 'rails_helper'
+
+describe EmojisController do
+  render_views
+
+  let(:emoji) { Fabricate(:custom_emoji) }
+
+  describe 'GET #show' do
+    subject(:responce) { get :show, params: { id: emoji.id, format: :json } }
+    subject(:body) { JSON.parse(response.body, symbolize_names: true) }
+
+    it 'returns the right response' do
+      expect(responce).to have_http_status 200
+      expect(body[:name]).to eq ':coolcat:'
+    end
+  end
+end