如何手动测试用CoffeeScript编写的AngularJS指令和Jasmine测试?

时间:2015-01-20 20:54:09

标签: angularjs unit-testing coffeescript rubygems jasmine

我正在编写一个Ruby gem,我在其中提供了许多angular指令。

使用以下文件夹结构编写指令,例如

app
 - assets
   - javascripts
     - components
        - dropdown
          - dropdown.html
          - dropdown.service.coffee
          - index.coffee (this has directive code)
spec
 - javascripts
   - dropdown
     - dropdown.service_spec.coffee (jasmine test)

既然这是一个宝石,我想保持它,而不是使它成为Rails应用程序。这将使人们更难将其用作宝石

但我希望能够测试指令。我不能自动这样做。

我想知道如何通过启动HTML页面来本地/手动运行这些用coffeescript编写的Jasmine测试?

1 个答案:

答案 0 :(得分:0)

您需要创建一个添加文件,jasmine和运行测试的HTML文件。

您可以使用众多现有的样板中的一个,而不是自己动手,如下所示:

https://github.com/andrewvida/coffeescript-jasmine-boilerplate