title: Using a javascript function within a jasmine test
body: <p>I am trying to use a function I have defined in a JS file within my Jasmine test, but it is coming back as undefined when I run the test. </p>
  
  <p>At the top of my spec I am requiring the coffee file I am using, would that then give me access to the contents of the JS? Could I then not use the function within my test?</p>
  
  <p>employer_category.coffee</p>
  
  <pre><code>$(document).ready -&gt;
    toggle_glyphicon_plus_minus
  
  toggle_glyphicon_plus_minus = () -&gt;
    $('#govt_category').click -&gt;
        $('#govt_category_span').toggleClass('glyphicon-plus glyphicon-minus')
      $('#federal_category').click -&gt;
        $('#federal_category_span').toggleClass('glyphicon-plus glyphicon-minus')
      $('#other_category').click -&gt;
        $('#other_category_span').toggleClass('glyphicon-plus glyphicon-minus')
  </code></pre>
  
  <p>employe_category_spec.coffee</p>
  
  <pre><code> #= require employer_category
  
      describe 'accordion functionality', -&gt;
        beforeEach -&gt;
          employer_category = "&lt;h5 id='govt_category'&gt;&lt;/h5&gt;" + "&lt;span id='govt_category_span' class='glyphicon glyphicon-plus'&gt;"
          $(employer_category).appendTo('body')
          $('#govt_category').trigger('click')
  
        it 'should invoke a click event on govt_category', -&gt;
          toggle_glyphicon_plus_minus
          expect($('#govt_category_span')).toHaveClass('glyphicon-minus')
  </code></pre>