jfirebaugh/konacha — pull request #60 by joliss (2012-08-15 18:06:35+00:00)
Title: Support server-side fixtures; remove undocumented config.application. Closes #57

The fixtures (if any) are to be defined in
spec/javascripts/ruby_fixtures.rb.

As documented in the README, the primary use case for this is creating
fixture models on the server side, and using our serializers (such as
active_model_serializers) to turn them into JSON. This way the fixture
data can't get out of sync with what the server actually sends.

We have the ruby_fixtures.rb file picked up by Rails's autoloading and
reloading mechanism. I'm not sure whether the way this is implemented is
ideal. That said, it's a good starting point for sure, and once we have
gained some experience with using this in practice, we can see if it
needs improving for Konacha 2.0.

The undocumented config.application option is going away with this
commit, since we need to access the options in the early
konacha.autoload initializer, before we're ready to instantiate the
default application.

The need to refer to Konacha::Spec::NotFound instead of NotFound in
spec.rb arises because the Reloader reloads spec.rb as well, and
NotFound refers to a stale class after the first reload.

I tested this with IE9. IE8 should work too, but IE7 likely not (because
it lacks JSON.parse).

I've tried using this in my client's real-world app with FactoryGirl and
active_model_serializers, and it serializes like a champ.

----------------------------

I'd perhaps suggest that we push out 1.4.2 first, and then get this one into 1.5.0.