私は次のジャスミン仕様を持つRailsアプリを書いています:
describe "buttons", ->
beforeEach ->
loadFixtures("foo.html")
alert("beforeEach: " + $("tr.foo").length)
describe ".hide_foo", ->
alert(".hide-foo: " + $("tr.foo").length)
...
expect($("tr.foo")).toBeHidden()
仕様は次のエラーで失敗しました:
TypeError: Cannot call method 'expect' of null
だから私はアラートを入れました。最初に「.hide-foo:0」が表示され、それを閉じると「beforeEach:44」が表示されます。明らかにエラーはexpect
、フィクスチャがロードされる前に呼び出しているためですが...各例の前に一体がbeforeEach
実行されないのはなぜですか?
私はjasminericeを使用して、RailsAssetPipelineを使用してCoffeescriptをコンパイルしています。バージョン:
$ bundle show jasmine && bundle show jasminerice
/home/tmacdonald/.rvm/gems/ruby-1.9.2-p320/gems/jasmine-1.2.0
/home/tmacdonald/.rvm/gems/ruby-1.9.2-p320/gems/jasminerice-0.0.9
ありがとう!