{"action":"created","issue":{"url":"https://api.github.com/repos/modeset/teaspoon/issues/416","labels_url":"https://api.github.com/repos/modeset/teaspoon/issues/416/labels{/name}","comments_url":"https://api.github.com/repos/modeset/teaspoon/issues/416/comments","events_url":"https://api.github.com/repos/modeset/teaspoon/issues/416/events","html_url":"https://github.com/modeset/teaspoon/issues/416","id":109560673,"number":416,"title":"require javascript file does not seem to add available functions","user":{"login":"terevos","id":8345872,"avatar_url":"https://avatars.githubusercontent.com/u/8345872?v=3","gravatar_id":"","url":"https://api.github.com/users/terevos","html_url":"https://github.com/terevos","followers_url":"https://api.github.com/users/terevos/followers","following_url":"https://api.github.com/users/terevos/following{/other_user}","gists_url":"https://api.github.com/users/terevos/gists{/gist_id}","starred_url":"https://api.github.com/users/terevos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terevos/subscriptions","organizations_url":"https://api.github.com/users/terevos/orgs","repos_url":"https://api.github.com/users/terevos/repos","events_url":"https://api.github.com/users/terevos/events{/privacy}","received_events_url":"https://api.github.com/users/terevos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-02T19:50:12Z","updated_at":"2015-10-05T14:31:54Z","closed_at":null,"body":"When requiring javascript files that are outside the application.js rails pipeline, js functions do not seem to be available. My application.js does not reference users/edit.js.erb, so I require it manually.\r\n\r\n--- user_edit_spec.coffee ---\r\n```\r\n#= require users/edit\r\ndescribe \"edit_user\", ->\r\n  it \"check for js functions defined in assets\", ->\r\n    expect( new applicationJsFunction ).toBeDefined()\r\n  it \"check for js functions required manually\", ->\r\n    expect( new userValidate ).toBeDefined() \r\n```\r\n--- edit.js.erb ---\r\n```\r\nfunction userValidate() {\r\n  var someStuff = true;\r\n  return someStuff;\r\n}\r\n```\r\n----\r\nFailures:\r\n\r\n  1) edit_user check for js functions required manually\r\n     Failure/Error: ReferenceError: Can't find variable: userValidate in http://127.0.0.1:51657/dev-assets/user_edit_spec.js?body=1\r\n"},"comment":{"url":"https://api.github.com/repos/modeset/teaspoon/issues/comments/145547037","html_url":"https://github.com/modeset/teaspoon/issues/416#issuecomment-145547037","issue_url":"https://api.github.com/repos/modeset/teaspoon/issues/416","id":145547037,"user":{"login":"terevos","id":8345872,"avatar_url":"https://avatars.githubusercontent.com/u/8345872?v=3","gravatar_id":"","url":"https://api.github.com/users/terevos","html_url":"https://github.com/terevos","followers_url":"https://api.github.com/users/terevos/followers","following_url":"https://api.github.com/users/terevos/following{/other_user}","gists_url":"https://api.github.com/users/terevos/gists{/gist_id}","starred_url":"https://api.github.com/users/terevos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terevos/subscriptions","organizations_url":"https://api.github.com/users/terevos/orgs","repos_url":"https://api.github.com/users/terevos/repos","events_url":"https://api.github.com/users/terevos/events{/privacy}","received_events_url":"https://api.github.com/users/terevos/received_events","type":"User","site_admin":false},"created_at":"2015-10-05T14:31:53Z","updated_at":"2015-10-05T14:31:53Z","body":"Thanks for getting back to me so quickly.\r\n\r\nmikepack, \r\n\r\nusers/edit.js.erb is under app/assets/javascripts. It's not in the assets pipeline (for various reasons).\r\n\r\nThe test does run, yes, but it doesn't matter whether I use parens for userValidate or not. I get the same result. table_prep test returns true and userValidate gives the exception. Those two functions are very similar in the assets. \r\n\r\nI've even tried copy and pasting userValidate function into the table_prep.js - it then loaded up fine and returned true.\r\n\r\nSo only when it's outside the assets pipeline do I have trouble. If I manually require a javascript, it doesn't seem to make the functions in that js asset file available in the spec."}}