So, people seem to talk about integrating RSpec and Jasmine together..
I am trying to do something really simple: Have a spec that verifies
that dom elements are actually captured and assigned to variables.
I can''t find any useful information online about how to setup something
like this?
So in otherwords, lets say I have a rails controller action with a
corresponding view... That view has something like:
<p class="special">I am so <a
href="#">special</a></p>
Then say I have a .js file that does:
window.accessibleStuff = { special_paragraph: $(''p.special''),
special_link: $(''p.special a'')
};
and then I want to have a simle spec that will do:
var elements = ["special_paragraph", "special_link"];
for (var i = 0; i < elements.length; i ++) {
var key = elements[i],
el = window.accessibleStuff[key];
expect(el.length).toEqual(1);
}
......
That seems like a simple and reasonable thing to want to have a test
for, but I don''t see how to set it up so that my rails controller
actions will be rendered when running my jasmine specs. It seems like
all the examples I see are about jasmine testing raw javascript logic,
not at all about verifying that interfacing with the dom or a library''s
api is
working.
Can anyone shed some light as to how I can get this setup?
Patrick J. Collins
http://collinatorstudios.com