Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 Cucumber CRUD编辑和预览页面_Ruby On Rails 3_Cucumber_Bdd_Crud - Fatal编程技术网

Ruby on rails 3 Cucumber CRUD编辑和预览页面

Ruby on rails 3 Cucumber CRUD编辑和预览页面,ruby-on-rails-3,cucumber,bdd,crud,Ruby On Rails 3,Cucumber,Bdd,Crud,我应该如何执行以下步骤: Given I should have Post with title "Hi" and text "Hello there" And I should be on the show page for Post with ... some data Then I click edit button And I should be on edit page #of the some earlier created object 首先,我是否可以保存在前面

我应该如何执行以下步骤:

 Given I should have Post with title "Hi" and text "Hello there"
 And I should be on the show page for Post with ... some data
 Then I click edit button
 And I should be on edit page     #of the some earlier created object
首先,我是否可以保存在前面步骤中创建的实体,而不是重复标题和文本(但是,在某些情况下,我无法确定它)?也许没有必要这么做,足够写smth,比如“我看到文本”title“? 我看到一些开发人员不通过bdd人员进行测试,比如路由(在我的例子中)、验证等等。你能给我什么建议


如果需要做这个路由测试,我如何解析这个字符串,因为它是一个典型的crud,也许它已经做了很多次了,但是我找不到它

您的问题很难理解,但要部分回答它:您可以使用实例变量在步骤之间共享状态,例如

Given /^a post$/
  @post = Post.create!(:title => '...')
end

When /^I edit that post$/
  visit post_edit_path(@post)
end

您的问题很难理解,但要部分回答它:您可以使用实例变量在步骤之间共享状态,例如

Given /^a post$/
  @post = Post.create!(:title => '...')
end

When /^I edit that post$/
  visit post_edit_path(@post)
end

似乎我在问题的第一部分找到了答案似乎我在问题的第一部分找到了答案