12、构建项目内的票务创建功能

构建项目内的票务创建功能

在完成项目资源的 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值