1
我正在寫一個Rails插件,我希望能夠在插件中測試控制器內使用RSpec控制器:測試軌道插件
describe ReportsController, :type => :controller do
it "shows paginated reports if the user is authorized" do
get 'index'
response.should render_template("index")
end
end
不幸的是這將導致以下錯誤:
在插件的spec_helper.rbNoMethodError in 'ReportsController index action shows paginated reports if the user is authorized'
undefined method `get' for #<Spec::Example::ExampleGroup::Subclass_1::Subclass_1:0x7f7155e042a0>
Rails的ENV加載:
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
任何想法?