Im pretty new to testing, I am just adding tests to an already existing application, here is my controller:
class JobsController < ApplicationController
before_action :set_job, only: [:show, :edit, :update, :destroy]
def index
if params[:filter]
@jobs = Job.order(applied_on: :asc)
else
@jobs = Job.all
end
end
end
Here is my spec file:
```
require 'rails_helper'
RSpec.describe JobsController, type: :controller do describe "#index" do
it "should render index template" do
get(:index)
expect(response).to render_template(:index)
end
end end
```
If i comment out the entire index action, and run the test - it still passes ? Why is this ?
Other scenerios I tried: Commenting out the routes resources :jobs makes the test fail
How can i fix this issue - cause its clear that the test is passing regardless of it testing the proper thing that needs to be tested here
Aucun commentaire:
Enregistrer un commentaire