ruby on rails - Need Help to write a jasmine spec -


Hi, I am trying to write a jassin test for backbone view and to use it in one of its functions too. I want to check the correct behavior of the function, when a user checks a checkbox in the rendered scene, then submit.

Here is the test:

  Description ("buildCI ()", function () {description ("Select a class with quidget model", function ( ) {this ( "Return" a CoacheeIssue model with the selected categories, function () {selection_allowed = true lcc_selection_allowed = false; var scene = new Rails3DeviseRspecCucumberkViewskCategoryPicker ({Collection: categoriesCollection, answers: answers, category_ids: category_ids, credibility : credentialsCollection, user_hash: user_hash, selection_allowed: selection_allowed, lcc_selection_allowed: lcc_selection_allowed}); // then render the scene we can shuffle view.render () your DOM elements. (view $ L) elDebug = $; / / Check $ a square box as the program (elDebug.find ( 'input.category- checkbox # 5061c6a48624da6f4100000a') [0]) Resort (. 'Czech', true); // buildCI () calls the function and results = view.b hope Check uildCI (); console.log (results); (hopefully Prinamkget ( 'categories')). Contanin ( "Series a"); (Prinamkget ( 'categories' )). No. Cotan ('Category Two'); })})   

Unfortunately the test fails with this message: Expected to include 'Category one' I know that this is not a coding error, because It's working in live, I want to know how to test it.

Here's the function:

  buildCI: () - & gt; # Category_ids and categories (name) explains ready responsible if @selection_allowed selectedCategories = [] if checkbox.checked selectedCategories.push (_. (Think box @collection $ ( 'input.category- box') checkboxEl = $ (box ) of .models, (model) - & gt; model.id == checkboxEl.attr ( 'ID'))) category_names = _.map (selectedCategories, (class) - & gt; category.get (named '' ) Category_ids = _.map (selected categories, (category) -> category.get ('_ id')) else category_names = _.map (@ collection.model, (category) -> category. Get ('Name')) category_ids = _ .map (@ collection.models, (category) -> category.get ('_ id')) returned Rails3DeviseRspecCucumber.Models.CoacheeIssue ({is_solved: false, status: 'active', solution_value_estimate: ', reply: @   

Is your selector extremely strict? I think this is:

  $ (elDebug.find ('input.category-checkbox # 5061c6a48624da6f4100000a') [0]) .pr. 'Check' is true);   

But perhaps you only want to do this:

  $ (elDebug.find ('input.category-checkbox') [0]). Prop ('check', right);    

Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -