First of all change match
to get
or post
- it is better to use exactly verb. Let's say it is get
.
Action next
is in QueueItemsController
so test should be in this queue_items_controller_spec.rb
file (and in folder spec/controlers
).
and test might be similar to
describe QueueItemsController do
describe "GET next " do
it "responses json" do
get :next, format: :json
expect(response).to be_success
end
it "does not response html" do
get :next, format: :html
expect(response).not_to be_success # or define more exactly response
end
it 'assigns @queue' do
get :next, format: :json
expect(assigns[:queue]).to eq('Regular')
end
end
end
if you would like to test your routes you should follow this articles:
https://www.relishapp.com/rspec/rspec-rails/v/2-14/docs/routing-specs https://www.relishapp.com/rspec/rspec-rails/docs/routing-specs/route-to-matcher