I just got off an interview (2nd one in the series) where I was asked for a test of my skills (I can hear the moans already).
This test would take between 5-7 (possibly more) hours. It would involve me doing the back end and front end. Not a problem.
This would be a section of their production code. Slight problem.
They would review it and then review it with me (The manager and 1 to 2 other techs) where I MAY get the job. A bit more of a problem.
I asked how much they were going to pay me for the time I am taking to fix their code? Nothing. Still not a major problem, but it's getting there.
I asked the final question. "Since you are giving me your word that you won't use the code in the production server, will you have any issue signing an NDA to that effect?"
The answer, "I'm not going to do that. My word is worth more than any document".
I ended the interview after. No matter how desperate I become, I'm not going to do free work (more than half an hour or so) for a chance of working for a company.
If you want to see how people code, tell them to share their IDE and ask them to code Fizz Bizz or some other thing that has nothing to do with your business to see how they do it (and you can walk with them so they can explain why they are doing what they are doing).
Either that, or ask them to send you some code snippets so you can review their code and see what they do for various issues.
If a company wants you to do this, then have enough respect for yourself to say no.