about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-06-08 01:59:28 +0900
committerMatt Jankowski <mjankowski@thoughtbot.com>2017-06-07 12:59:28 -0400
commit0f1b1d78b15bd779c3427d4275d45d3e34e0b2ef (patch)
tree46023cf3e052fb90cde91cf34465ed76c90d7195 /spec
parentd3bbef27e7f15d1322e26ab181a18b2520f9dff6 (diff)
Use "match_array" only for order independent assertions (#3626)
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/application_controller_spec.rb4
-rw-r--r--spec/controllers/statuses_controller_spec.rb2
-rw-r--r--spec/controllers/stream_entries_controller_spec.rb4
-rw-r--r--spec/models/user_spec.rb4
4 files changed, 7 insertions, 7 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 9370dcdad..6a54a78c5 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -266,7 +266,7 @@ describe ApplicationController, type: :controller do
     shared_examples 'receives :with_includes' do |fabricator, klass|
       it 'uses raw if it is not an ActiveRecord::Relation' do
         record = Fabricate(fabricator)
-        expect(C.new.cache_collection([record], klass)).to match_array([record])
+        expect(C.new.cache_collection([record], klass)).to eq [record]
       end
     end
 
@@ -277,7 +277,7 @@ describe ApplicationController, type: :controller do
         record = Fabricate(fabricator)
         relation = klass.none
         allow(relation).to receive(:cache_ids).and_return([record])
-        expect(C.new.cache_collection(relation, klass)).to match_array([record])
+        expect(C.new.cache_collection(relation, klass)).to eq [record]
       end
     end
 
diff --git a/spec/controllers/statuses_controller_spec.rb b/spec/controllers/statuses_controller_spec.rb
index c329996c8..88d365624 100644
--- a/spec/controllers/statuses_controller_spec.rb
+++ b/spec/controllers/statuses_controller_spec.rb
@@ -61,7 +61,7 @@ describe StatusesController do
 
         get :show, params: { account_username: status.account.username, id: status.id }
 
-        expect(assigns(:ancestors)).to match_array([ancestor])
+        expect(assigns(:ancestors)).to eq [ancestor]
       end
 
       it 'assigns @ancestors for [] if it is not a reply' do
diff --git a/spec/controllers/stream_entries_controller_spec.rb b/spec/controllers/stream_entries_controller_spec.rb
index db7c52037..2cc428e0c 100644
--- a/spec/controllers/stream_entries_controller_spec.rb
+++ b/spec/controllers/stream_entries_controller_spec.rb
@@ -73,8 +73,8 @@ RSpec.describe StreamEntriesController, type: :controller do
 
       get :show, params: { account_username: status.account.username, id: status.stream_entry.id }
 
-      expect(assigns(:ancestors)).to match_array([ancestor])
-      expect(assigns(:descendants)).to match_array([descendant])
+      expect(assigns(:ancestors)).to eq [ancestor]
+      expect(assigns(:descendants)).to eq [descendant]
       expect(response).to have_http_status(:success)
     end
 
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 735c78c64..9cb36d467 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe User, type: :model do
       it 'returns an array of recent users ordered by id' do
         user_1 = Fabricate(:user)
         user_2 = Fabricate(:user)
-        expect(User.recent).to match_array([user_2, user_1])
+        expect(User.recent).to eq [user_2, user_1]
       end
     end
 
@@ -92,7 +92,7 @@ RSpec.describe User, type: :model do
         ]
         Fabricate(:user, current_sign_in_ip: '0.0.0.0', last_sign_in_ip: '0.0.0.0')
 
-        expect(User.with_recent_ip_address('0.0.0.42')).to eq specifieds
+        expect(User.with_recent_ip_address('0.0.0.42')).to match_array(specifieds)
       end
     end
   end