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
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
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
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
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
]
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