构建项目内的票务创建功能
在完成项目资源的 CRUD 操作后,下一步是实现为特定项目创建票务的功能。这种在一个对象范围内对另一个对象执行操作的方式被称为嵌套。下面将详细介绍如何为票务资源设置嵌套路由,并创建相应的 CRUD 接口。
1. 创建票务功能概述
要在项目下添加创建票务的功能,首先需要开发 Cucumber 特性,然后实现使这些特性通过的代码。这涉及到额外的路由设置、Active Record 中的关联操作以及更多的 before_filter 使用。
2. 开发 Cucumber 特性
创建一个新文件 features/creating_tickets.feature ,并使用以下代码:
Feature: Creating Tickets
In order to create tickets for projects
As a user
I want to be able to select a project and do that
Background:
Given there is a project called "Internet Explorer"
And I am on the homepage
When I follow "Internet Explorer"
And I follow "New Ticket"
Scenario: Creating a ticket
When I fill in "Title" with "Non-standards compliance"
And I f
超级会员免费看
订阅专栏 解锁全文
5517

被折叠的 条评论
为什么被折叠?



