问题描述
当我运行这个命令时:rspec spec/controllers/messages_controller_spec.rb
我明白了:
在 0.54446 秒内完成
2 个例子,0 个失败
2 examples, 0 failures
随机种子 6226
还不错.
但是当我运行这个命令时:
However when I run this command:
zeus rspec spec/controllers/messages_controller_spec.rb
我明白了:
在 0.5356 秒内完成
2 个例子,0 个失败
2 examples, 0 failures
用种子 0 随机化
这不是问题,但我马上也明白了:
This is not a problem, but then immediately I get also this:
F.
失败:
1) MessagesController POST #create 创建一个带有 HTTP 的消息200 状态码
1) MessagesController POST #create create a message with an HTTP 200 status code
Failure/Error: post :create, message: "test message"
NameError:
undefined method `post' for #<RSpec::Core::ExampleGroup::Nested_2::Nested_1:0xb0085d8>
# ./spec/controllers/messages_controller_spec.rb:10:in `block (3 levels) in <top (required)>'
# -e:1:in `<main>'
在 0.10724 秒内完成2 个例子,1 个失败失败的例子:
Finished in 0.10724 seconds 2 examples, 1 failure Failed examples:
rspec ./spec/controllers/messages_controller_spec.rb:9 #MessagesController POST #create 创建一条带有 HTTP 200 的消息状态码
rspec ./spec/controllers/messages_controller_spec.rb:9 # MessagesController POST #create create a message with an HTTP 200 status code
推荐答案
删除一行:
require 'rspec/autorun'
来自您的 spec_helper.rb.
from your spec_helper.rb.
这篇关于使用 Rspec 进行测试时,Zeus 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!