@@ -7,7 +7,6 @@ module VCAP::CloudController
77 describe '.fetch' do
88 before do
99 Route . dataset . destroy
10- # shared_route.add_shared_space(space2)
1110 end
1211
1312 let! ( :space1 ) { Space . make }
@@ -17,7 +16,6 @@ module VCAP::CloudController
1716 let! ( :route1 ) { Route . make ( guid : 'route1_guid' , host : 'host1' , path : '/path1' , space : space1 , domain : domain1 ) }
1817 let! ( :route2 ) { Route . make ( guid : 'route2_guid' , host : 'host2' , path : '/path2' , space : space1 , domain : domain1 ) }
1918 let! ( :route3 ) { Route . make ( guid : 'route3_guid' , host : 'host3' , path : '/path1' , space : space2 , domain : domain2 ) }
20- # let!(:shared_route) { Route.make(guid: 'shared_route_guid', host: 'host2', path: '/path1', space: space1, domain: domain2) }
2119
2220 let ( :message ) do
2321 RoutesListMessage . from_params ( routes_filter )
@@ -30,14 +28,22 @@ module VCAP::CloudController
3028 expect ( RouteFetcher . fetch ( message , omniscient : true ) . all ) . to contain_exactly ( route1 , route2 , route3 )
3129 end
3230
31+ it 'does not duplicate routes when shared' do
32+ space3 = Space . make
33+ shared_route = Route . make ( guid : 'shared_route_guid' , host : 'host1' , path : '/path_shared' , space : space1 , domain : domain1 )
34+ shared_route . add_shared_space ( space2 )
35+ shared_route . add_shared_space ( space3 )
36+ expect ( RouteFetcher . fetch ( message , omniscient : true ) . all ) . to contain_exactly ( route1 , route2 , route3 , shared_route )
37+ end
38+
3339 it 'fetches the routes owned by readable spaces' do
3440 dataset = RouteFetcher . fetch ( message , readable_space_guids_dataset : Space . where ( id : [ space1 . id ] ) . select ( :guid ) )
3541 expect ( dataset . all ) . to contain_exactly ( route1 , route2 )
3642 end
3743
3844 it 'fetches the instances shared to readable spaces' do
39- space4 = Space . make
40- shared_route = Route . make ( space : space4 )
45+ space3 = Space . make
46+ shared_route = Route . make ( space : space3 )
4147 shared_route . add_shared_space ( space2 )
4248 dataset = RouteFetcher . fetch ( message , readable_space_guids_dataset : Space . where ( id : [ space2 . id ] ) . select ( :guid ) )
4349 expect ( dataset . all ) . to contain_exactly ( route3 , shared_route )
0 commit comments