UnknownStudy correctly raised

Fix: UnknownStudy is raised correctly
Add specs for updating study_samples table.