You can send xhr requests in your rspec tests by using xhr instead of get or post followed by a symbol of the submission method like this: xhr :get, :index, :id = 10
xhr
get
post
xhr :get, :index, :id = 10