Define contexts test

Closes #959