So I'm trying to write some tests for my API
I have this url /v1/users?api_key=1:--XsF99m7wcvFFzTt-Js
which if I go to it in the browser works fine and a bit of JSON is returned.
However, in my test is
require 'rails_helper'
RSpec.describe "GET /users/index" do
it 'returns a 200' do
get "/v1/users?api_key=1:--XsF99m7wcvFFzTt-Js"
expect(response.status).to eq(200)
end
end
and when I run the RSpec it give me this error
ActionView::MissingTemplate:
Missing template v1/users/index, api_v1/index, application/index with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder]}. Searched in:
Which i don't understand why as if i paste the url into the browser it works fine.
So firstly is there anything wrong with that respec test? Also in terms of debugging how are you meant to debug? As I can't see any log file like you would if you were doing it through the browser and would see development.log filling up
Aucun commentaire:
Enregistrer un commentaire