我正在编写用户验收测试。该应用程序由使用factory_girl的模拟用户组成,我还没有实现。但在这一点上,poltergeist / turnip / rspec工作正常,但我不喜欢目录结构,我觉得我没有正确使用萝卜,因为我的步骤和规格是单独的文件,但共享很多功能。
我有这个结构:
Gemfile
Gemfile.lock
spec/
│
├── acceptance
│ ├── homepage.feature
│ ├── chat.feature
│ │
│ │── steps
│ ├── homepage_steps.rb
│ ├── chat_steps.rb
│
├── chat_spec.rb
├── spec_helper.rb
└── support
├── capybara_helper.rb
├── helpers.rb
├── poltergeist_helper.rb
└── turnip_helper.rb
steps / chat_steps.rb包含
steps_for :group_chat
step "..." do
end
end
while spec / acceptance / chat.feature包含
@group_chat
Scenario: ...
Given ...
And ...
Then ...
chat_spec.rb怎么样?应该将这个和chat_steps.rb文件集成在一起吗?
约定是使用规范/接受还是步骤/功能?
答案 0 :(得分:0)
您能举例说明共享功能吗?
chat_spec可能应包含聊天模型的单元测试;我不明白为什么会与chat_steps重叠;如果您提取的常用方法由两者使用,则只需将它们粘贴在单独的文件中
你可以将你的功能放在你喜欢的任何目录中(我使用规格/功能),虽然萝卜文档只提到规格/接受