Setup: Place a rail. Place a minecart on that rail. Place a shulker egg next to the minecart so it goes into it. Break the minecart by punching it a bunch. Done! You can see the rail is still there when the shulker looks out of its shell.
Hopper minecarts, chest minecarts, minecarts with mobs in them, & furnace minecarts can go through the shulker. Not normal, empty minecarts because they put the shulker into it.