I am removing a bathroom fixture that was attached to this cold water supply line:

I need to plug the pipe so it doesn't spray water when I turn it back on. Previously it had this fitting:

I tried this cap, but it leaked quite a bit.

I searched through many fittings at the hardware store, and finally ended up with this valve:

which worked (except when I put it on backwards, then it squirted water out, ack!).
It took 4 trips to the hardware store to arrive at this solution, and it's not really ideal, since I never want to turn it on. What would an ace plumber have done instead?
