dimanche 20 juin 2021

Byebug does not pauses in controller in RSpec request spec

I have added byebug breakpoint in spec code and it pauses the code there.

require 'rails_helper'

RSpec.describe "UsedCars", :type => :request do
  describe "POST /used_cars" do
    it "creates a used car ad" do  
      byebug # <- stop here  
      count = UsedCar.count
      post used_cars_path, used_car: attributes_for(:used_car)
      expect(UsedCar.count).to eq(count + 1)
    end
  end
end

But when I add the breakpoint in the controller-action method of the request being tested. it does not stop there. I have even tried it in the top-level before_filter for application_controller.

app/controllers/used_car_controller.rb

def create
   byebug # <- does not stop here
   ....
end

Even in the application_controller.rb

# top before_filter
before_fitler :stop
...

def stop
   byebug # does not even stop here
end

I am using Rails 3 with ruby 2.2.8

Aucun commentaire:

Enregistrer un commentaire