给出以下测试文件
require 'rails_helper'
RSpec.describe PurchaseCarService, type: :service do
#...
end
如何对:service
类型的所有规格执行通用测试?
我打算让所有(例如)服务对象强制执行通用的服务标准。
此致
答案 0 :(得分:3)
使用filtering,我可以运行其他测试,然后每个测试都使用上下文type: :service
描述块。
例如
RSpec.configure do |c|
c.before(:example, type: :service) do
# Run some common tests
end
end