2017-05-05 1 views
0

rake jasmine을 사용하면 브라우저에서 모든 테스트가 통과됩니다.왜 레이크 재스민은 패스하지만 레이크 재스민 : ci는 TypeError와 함께 실패합니다 : undefined is not function?

function Song() { 
... 

가 왜 : 레이크 자스민와

, 2 사양이 실패 함께 : 그것은

src_files: 
    - src/Player.js 
    - src/Song.js 
spec_files: 
    - '**/*[sS]pec.js' 
src_dir: 
spec_dir: spec 

src/Song.js가 가질 수 있도록

TypeError: undefined is not a function (evaluating 'expect(player).not.toBePlaying(song)') in http://localhost:36091/__spec__/PlayerSpec.js (line 28) 

spec/javascripts/support/jasmine.yml 파일을 구성한 rake jasmine:ci 두 가지 예에 실패했습니다.

번째의 고장 하나의 코드는 다음과 같습니다 나는 모든 5 예는 실패를 제거하기 때문에 경우

it("should be able to play a Song", function() { 
    player.play(song); 
    expect(player.currentlyPlayingSong).toEqual(song); 

    //demonstrates use of custom matcher 
    expect(player).toBePlaying(song); # <-- error here 
}); 

Song.js로드 할 것처럼 보인다.

답변

0

나는 사용자 정의 toBePlaying

내가 모든 사양이 spec/javascripts/support/jasmine.yml 파일이 변경 지나가는 얻을 수있었습니다 경우 matcher 필요 :

src_files: 
    - src/Player.js 
    - src/Song.js 
    - spec/SpecHelper.js # <--- Added to include the custom helper 'toBePlaying' 

나는 spec_files 섹션에 추가하려했지만이 필요 src_files