about summary refs log tree commit diff
path: root/spec/controllers/api/v1/notifications_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/api/v1/notifications_controller_spec.rb')
-rw-r--r--spec/controllers/api/v1/notifications_controller_spec.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/controllers/api/v1/notifications_controller_spec.rb b/spec/controllers/api/v1/notifications_controller_spec.rb
index 46e177c0e..f6cbd105e 100644
--- a/spec/controllers/api/v1/notifications_controller_spec.rb
+++ b/spec/controllers/api/v1/notifications_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Api::V1::NotificationsController, type: :controller do
@@ -70,19 +72,19 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
       end
 
       it 'includes reblog' do
-        expect(body_as_json.map { |x| x[:type] }).to include 'reblog'
+        expect(body_as_json.pluck(:type)).to include 'reblog'
       end
 
       it 'includes mention' do
-        expect(body_as_json.map { |x| x[:type] }).to include 'mention'
+        expect(body_as_json.pluck(:type)).to include 'mention'
       end
 
       it 'includes favourite' do
-        expect(body_as_json.map { |x| x[:type] }).to include 'favourite'
+        expect(body_as_json.pluck(:type)).to include 'favourite'
       end
 
       it 'includes follow' do
-        expect(body_as_json.map { |x| x[:type] }).to include 'follow'
+        expect(body_as_json.pluck(:type)).to include 'follow'
       end
     end
 
@@ -125,7 +127,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
 
       it 'returns everything but excluded type' do
         expect(body_as_json.size).to_not eq 0
-        expect(body_as_json.map { |x| x[:type] }.uniq).to_not include 'mention'
+        expect(body_as_json.pluck(:type).uniq).to_not include 'mention'
       end
     end
 
@@ -139,7 +141,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
       end
 
       it 'returns only requested type' do
-        expect(body_as_json.map { |x| x[:type] }.uniq).to eq ['mention']
+        expect(body_as_json.pluck(:type).uniq).to eq ['mention']
       end
     end
   end