Ruby on rails 如何rspec测试swagger_api块
我正在rails应用程序中使用swagger文档,并定义了一个动作swagger_api,如下所示:Ruby on rails 如何rspec测试swagger_api块,ruby-on-rails,rspec,Ruby On Rails,Rspec,我正在rails应用程序中使用swagger文档,并定义了一个动作swagger_api,如下所示: swagger_api :create do summary 'Create an account' notes 'create-account' param :body, :body, :JSON, :required, 'body' response :unprocessable_entity end module ClassMethods de
swagger_api :create do
summary 'Create an account'
notes 'create-account'
param :body, :body, :JSON, :required, 'body'
response :unprocessable_entity
end
module ClassMethods
def swagger_api(action, params = {}, &block)
end
如何测试swagger_api的块
更多信息:swagger_api是模块的ClassMethods,其定义如下:
swagger_api :create do
summary 'Create an account'
notes 'create-account'
param :body, :body, :JSON, :required, 'body'
response :unprocessable_entity
end
module ClassMethods
def swagger_api(action, params = {}, &block)
end
你想测试什么?我想测试swagger_api块中的逻辑,就像“summary‘create a account’”,找不到这样做的方法。这对我来说没有多大意义。为什么要在应用程序中测试库的功能?这应该是swagger api gem测试套件的一部分。