Rspec测试一个接一个地成功,但是当我一起运行它们时却无法成功

时间:2018-09-19 12:40:51

标签: ruby-on-rails rspec ruby-on-rails-5

我有这段代码,简化了:

def get_my_events(access_token):
get_events_url = graph_endpoint.format('/me/events')
# Create JSON payload
data ={
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does late morning work for you?"
 },
 "start": {
  "dateTime": "2018-10-15T12:00:00",
  "timeZone": "Pacific Standard Time"
 },
 "end": {
  "dateTime": "2018-010-16T14:00:00",
  "timeZone": "Pacific Standard Time"
 },
"location":{
  "displayName":"Harry's Bar"
 },
"attendees": [
{
  "emailAddress": {
    "address":"samanthab@contoso.onmicrosoft.com",
    "name": "Samantha Booth"
  },
  "type": "required"
}
 ]
 }
r = make_api_call('POST', get_events_url, access_token, payload = data)
print(r)
return "{0}: {1}".format(r.status_code, r.text)

问题是:当我使用行号逐个运行这些测试时,它们都完美无误地通过了。

当我一起运行它们时,第一个通过,第二个失败:它们返回404表示“投入”

怎么可能?没有通过“ url1”删除或创建的任何内容,仅更新了一个布尔值。

0 个答案:

没有答案