开发者

Testing controller name that breaks naming convention

I have called my controller

UtilityDREventsController

though it is defined in the file named

utility_dr_events_controller.rb.

The application is working fine the only thing I had to do was to pass

resources :utility_dr_events, :controller => 'UtilityDREvents'

when defining routes in routes.rb. But I have issues when I want to write spec for it:

describe UtilityDREventsController do
  describe :index do
    it "should be redirect" do
      get :index
      response.should be_redirect
    end
  end
end

It is failing with such error:

1) UtilityDREventsContro开发者_运维百科ller index should be redirect
   Failure/Error: get :index
   ActionController::RoutingError:
     No route matches {:controller=>"utility_dr_events"}
   # ./spec/controllers/utility_dr_events_controller_spec.rb:4:in `block (3 levels) in <top (required)>'

I've tried passing :controller option like that:

get :index, :controller => 'UtilityDREvents'

But without luck. Anyone have some idea?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜