简体   繁体   English

黄瓜:创建比较两个类别的步骤定义

[英]Cucumber: creating a step definition that compares two categories

I have a step in one of my cucumber features called 我在我的一个黄瓜特征中有一个步骤叫做

Then the director of "Alien" should be "Ridley Scott"

And I created my step definition as follows 我创建了我的步骤定义如下

Then /^the director of "([^"]*)" should be "([^"]*)"$/ do |arg1, arg2|
  Movie.find_by_title(arg1) == Movie.find_by_director(arg2)
end

Which passes the test but I don't believe it is truly correct. 通过了测试,但我不认为这是真的正确。 Any suggestions on implementing proper functionality? 有关实施适当功能的任何建议?

怎么样

Movie.find_by_title(arg1).director == arg2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM