나는 컬렉션 a를 채우는 시도 다른 방법과 지금 그것은 작동합니다. 내 테스트는 첫 번째가 생략 될 때 어떻게 생겼는지
(specrunner는 0이 코드를 생략 한 사양 통과했다) :
그들은 지금 어떤 모습인지
describe "Products Collection", ->
it "should filter a specific price", ->
products = new Wishlist.Collections.Products
products.add({name: 'product1', price: 15.99})
products.add({name: 'product2', price: 21.99})
products.add({name: 'product3', price: 21.99})
products.add({name: 'product4', price: 1.99})
match = products.where({price: 21.99})
expect(match.length).toBe(2)
it "should filter a range of prices", ->
products = new Wishlist.Collections.Products
products.add({name: 'product1', price: 15.99})
products.add({name: 'product2', price: 21.99})
products.add({name: 'product3', price: 21.99})
products.add({name: 'product4', price: 1.99})
expect(products.priceFilter(16,25).size()).toBe(2)
(제대로 작동) :
describe "Products Collection", ->
it "should filter a specific price", ->
products = new Wishlist.Collections.Products [{name: 'product1', price: 15.99}, {name: 'product2', price: 21.99}, {name: 'product3', price: 21.99}, {name: 'product4', price: 1.99}]
match = products.where({price: 21.99})
expect(match.length).toBe(2)
it "should filter a range of prices", ->
products = new Wishlist.Collections.Products
products.add({name: 'product1', price: 15.99})
products.add({name: 'product2', price: 21.99})
products.add({name: 'product3', price: 21.99})
products.add({name: 'product4', price: 1.99})
expect(products.priceFilter(16,25).size()).toBe(2)
두 번째 테스트에서 작동하므로 products.add()를 사용하면 문제가 발생하지 않을 수 있습니다. 나는 그것이 중요한 이유를 전혀 모른다.
specrunner는 실제로 2 개의 스펙이있을 때 specrunner가 1 스펙을 전달한다고 말하고있다. 나는 그것을 고쳤지만, 왜 고쳐야할지 모르겠다. 아래에서 읽으십시오 –