How to access Rails devices from javascript unit tests?

We did a lot of field testing on the rails side of our application and started testing unit tests on the javascript side using Teaspoon / Mocha / Sinon / Expectjs.

Now that we are digging deeper, we are trying to find the right way to access the rail snap data. For example, we want to have the correct api-call for (mocking) the server with the ActiveRecordmodel number id(for calling, for example, /users/:some_id), but they are generated at runtime by the generation of the device.

So far, the only way we have worked is to create a MagicLampreinforcement that displays json (rather than, say, partial rails) and then calls MagicLamp.loadJSON()instead MagicLamp.load. However, this seems like a hacker way to achieve this. In fact, we hoped that we would have a file such as magic_lamp.rbwhere you can simply configure a function similar to the helpers created by Rails (for example, users(:name_of_user)for a file users.yml).

I admit that I may be asking the wrong question here because it seems like it should be trivial. Maybe we are wrong?

+4
source share

All Articles