A quick note regarding my set up:
- I started this so I could really dig into Backbone Models and (maybe) Collections
- Using Jasmine 1.2.0 for my testing framework
- I had changed the test for "should not allow for me to create a character without a name" to just check the isValid() attribute to get by the issue there, but when I ran into it again with Alignment, it bothered me enough to attempt to fix
- Yes, this IS the Evercraft Kata in Backbone... At least, where I've made it to before running into the problem.
The assertions you are making regarding validation are slightly off, I've made the tests pass by changing the assertions somewhat:
Note that validation doesn't actually prevent you from creating an instance of a model in Backbone given that instantiation happens client-side. The intended workflow of validate, as per the docs is to run on model.save() and model.set(), so you would create a model client-side with some attributes then attempt to save the data to the server. Once that happens you can code whatever validation logic to prevent an invalid model from being persisted.