[英]What does the 'specify' method do in ruby on rails?
So I'm working through chapter 6 of Michael Hartl's tutorial and I came across this code 因此,我正在研究Michael Hartl教程的第6章,并且遇到了这段代码
describe "with invalid password" do
let(:user_for_invalid_password) { found_user.authenticate("invalid") }
it { should_not eq user_for_invalid_password }
specify { expect(user_for_invalid_password).to be_false }
What does the last line do? 最后一行是做什么的? Specifically, what does specify do?
具体来说,指定做什么? I couldn't find anything on it through google.
我通过Google找不到任何东西。
specify
is the same as it
- some people think it reads better. specify
与it
相同-有些人认为它读起来更好。
For a detailed example that shows the different context you may choose to use it, have a look at this example Difference between an it block and a specify block in RSpec 有关显示不同上下文的详细示例,您可以选择使用它,请看一下此示例RSpec中的it块和指定块之间的区别
specify
is simply the alias of it
. specify
只是it
的别名。 You can check here 你可以在这里查看
you can check more here Difference between an it block and a specify block in RSpec 您可以在此处查看更多信息RSpec中的it块和指定块之间的区别
The last line just check it is false
or not if it you supply invalid password. 如果您提供的密码无效,最后一行仅检查它是否为
false
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.