Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 63f2c3e

Browse files
tcdowneycwlbraa
andcommitted
order included spaces by created_at
- ensures a consistent experience for users and tests 😊 [#174502491](https://www.pivotaltracker.com/story/show/174502491) Co-authored-by: Tim Downey <tdowney@vmware.com> Co-authored-by: Connor Braa <cbraa@pivotal.io>
1 parent 336af42 commit 63f2c3e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

β€Žapp/decorators/include_space_decorator.rbβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def match?(include)
88
def decorate(hash, resources)
99
hash[:included] ||= {}
1010
space_guids = resources.map(&:space_guid).uniq
11-
spaces = Space.where(guid: space_guids)
11+
spaces = Space.where(guid: space_guids).order(:created_at)
1212

1313
hash[:included][:spaces] = spaces.map { |space| Presenters::V3::SpacePresenter.new(space).to_hash }
1414
hash

β€Žspec/request/routes_spec.rbβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
RSpec.describe 'Routes Request' do
77
let(:user) { VCAP::CloudController::User.make }
88
let(:admin_header) { admin_headers_for(user) }
9-
let!(:space) { VCAP::CloudController::Space.make(name: 'a-space') }
10-
let!(:org) { space.organization }
9+
let!(:org) { VCAP::CloudController::Organization.make(created_at: 1.hour.ago) }
10+
let!(:space) { VCAP::CloudController::Space.make(name: 'a-space', created_at: 1.hour.ago, organization: org) }
1111

1212
let(:space_json_generator) do
1313
lambda { |s|

0 commit comments

Comments
Β (0)