我正在做作业,但我对非 RestFul 路线有疑问。我的规格是:
require 'spec_helper'
describe MoviesController do
describe 'searching TMDb' do
before :each do
@fake_results = [mock('Movie'), mock('Movie')]
end
it 'should call the model method that performs TMDb search' do
Movie.should_receive(:find_in_tmdb).with('Star Wars').
and_return(@fake_results)
get :search_similar_movies, { :search_terms => 'Star Wars' }
end
end
end
在 config/routes.rb 我有:
resources :movies
'movies/search_similar_movies/:search_terms'
但是当我运行自动测试时,它给了我以以下开头的错误:
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:181:in `default_controller_and_action': missing :action (ArgumentError)
很明显,config/routes.rb 出了点问题。如何解决这个问题?