ID thos Mediterranean shrub (photo and description)

On a recent trip to Spain, I found a lot of these plants growing on semi-arid scrub environments:

http://1drv.ms/1dnuBBT

The plant was a spreading, fairly low growing shrub with bipinnate leaves which were deep green and slightly glaucous. Small, sharp spines were hidden in the leaf joints)
It was conspicuously green at a time when most other plants were baked to brown crispy remnants, so maybe it has a deep root system or water storage taproot.
The flowers were about 7cm across, fragrant and opening in the evening, closing early morning.
The fruit was a tough rubbery green ovoid with longitudinal stripes (resembling a small melon), hanging vertically downwards from the stem, I broke one open and it was filled with a mass of small black seeds and whitish, juicy pulp.

The plant has many features that I would expect of a legume, and my initial searches suggested Albizia, but the fruit of that plant is a dry, flat pod.

Ha. I just found it. Its the caper bush. (on a whim, I googled ‘spinosa’, figuring the Latin name might mention the prickles)

You’ve never eaten capers before? You, of all Dopers?

So those are caper berries in the picture? Cool.

Sure, I like them, but the plant doesn’t particularly resemble the condiment.

Or rather, I was wowed by the flowers and hardly noticed the buds.

Those are capers (buds). Caper berries are the immature form of the fruit I described (I don’t think there are any visible in the photo).