3
我的应用程序控制器中包含一些第三方库。Rspec,确保在Rails控制器类上调用方法
require 'new_relic/agent/method_tracer'
class ApplicationController < ApplicationController::Base
end
我想在我SearchController使用它在我的其他控制器,例如
class SearchController < ApplicationController
add_method_tracer :show, 'Custom/FU'
end
我知道,我可以通过rspec的检查由控制器库提供的方法存在:
require 'spec_helper'
describe SearchController do
it "has newrelic method tracer enabled" do
SearchController.should respond_to :add_method_tracer
end
end
但是,此解决方案不检查正确的方法参数。
我如何能确保(通过RSpec的测试)的SearchController有:
add_method_tracer :show, 'Custom/FU'
线存在,并且它被称为用正确的参数?
简单地说,我希望有一个测试,当有人意外删除从控制器add_method_tracer其失败......然后......我想确保,该方法被调用合适的参数。