Closed absynce closed 11 years ago
This test is necessary because it is a different case. The test before it calls a save on an existing record, which works fine. This test skips validation when a new record is saved.
I understand that. I'm talking about stub you're using within your test. It looks incorrect.
On Tue, Aug 20, 2013 at 7:05 PM, Jared M. Smith notifications@github.comwrote:
This test is necessary because it is a different case. The test before ithttps://github.com/absynce/jugglingdb/blob/93542c3df01947014ce30534541213b7a8981ba3/test/manipulation.test.js#L145-L163calls a save on an existing record, which works fine. This test skips validation when a new record is saved.
— Reply to this email directly or view it on GitHubhttps://github.com/1602/jugglingdb/pull/315#issuecomment-22951551 .
Previously, if a new instance of a model calls
save({ validate: false }
, validation still occurred because it was callingModel.create
.I've added the ability to pass the option to validate to the Model.create via the
data
parameter.For example:
I included the test for this case as well.
P.S. I know passing the data into the
data
parameter looks odd when it is then set viadata = data.data;
, but I couldn't think of a better name and didn't want to rename the existing parameter. Ideas are welcome.