【发布时间】:2015-09-18 21:35:03
【问题描述】:
全部!
使用 AngularJS、Rails、Jasmine
当我在测试中使用来自 $httpBackend 服务的expect 时,
根据official docsexpect(method, url, [data], [headers]);
在我的测试中:
describe 'when something', ->
it 'response success', ->
@http.expect('GET', 'acts/1', {month: '09/2015'}).respond(200)
@scope.createAct()
@http.flush()
,但是,当我运行测试时,引发异常:
Error: Unexpected request: GET acts/1?id=1&month=09%2F2015
Expected GET acts/1
我试过插入哈希、字符串、json等数据,结果是一样的……
只有当我使用带有数据的 url 时它才有效:
@http.expect('GET', 'acts/1?id=1&month=09%2F2015').respond(200)
所以它不能正常工作
也许有人可以说,我如何将数据插入expect 方法???
谢谢!
【问题讨论】: