ActiveAdmin 操作测试
ActiveAdmin actions testing
我有 ActiveAdmin 控制器来处理一些数据库对象。
ActiveAdmin.register MyObject do
在那个文件中我得到了一个动作,它使用了一些参数并创建了一个文件:
collection_action :some_method_name, method: :get do
为将传递一些参数并在生成的文件中执行检查的操作创建 RSpec 规范的正确方法是什么?
require 'spec_helper'
describe Admin::MyObjectsController do
describe "#some_method_name" do
it "does some stuff" do
params = {a: 1, b: 2}
get :some_method_name, params
expect(response).to be_success
end
end
end
我有 ActiveAdmin 控制器来处理一些数据库对象。
ActiveAdmin.register MyObject do
在那个文件中我得到了一个动作,它使用了一些参数并创建了一个文件:
collection_action :some_method_name, method: :get do
为将传递一些参数并在生成的文件中执行检查的操作创建 RSpec 规范的正确方法是什么?
require 'spec_helper'
describe Admin::MyObjectsController do
describe "#some_method_name" do
it "does some stuff" do
params = {a: 1, b: 2}
get :some_method_name, params
expect(response).to be_success
end
end
end