我是黄瓜的新手,我正在学习BDD
当我尝试填写表单并创建记录时,会显示此sqlite错误,但是当我在浏览器中手动尝试代码时没有错误.
我正在使用rails 4.
这是我的控制器代码
class Admin::ItemsController < ApplicationController
def index
@items=Item.all
end
def new
@item=Item.new
end
def create
@item=Item.new items_params
respond_to do |format|
if @item.save
format.html { redirect_to admin_items_path }
else
format.html { redirect_to new_admin_items_path }
end
end
end
private
def items_params
params.require(:item).permit(:name,:price)
end
end
Run Code Online (Sandbox Code Playgroud)
这是我的功能文件
Feature: Manage Items
In order to make a store
As an admin
I want to create and manage items
Scenario: Items List
Given I go to the new admin item page
And I …
Run Code Online (Sandbox Code Playgroud)