mardi 13 octobre 2020

def setup of second test called before completion of first test rails

class Api::V1::ManufacturersControllerTest < ActionDispatch::IntegrationTest

  setup do
    p "setup called"
    @manufacturer1 = create(:manufacturer, name: "ABC")
    @manufacturer2 = create(:manufacturer)
  end

  def test_1
   p"test1"
  end

  def test_2
   p"test2"
  end
end

So the output I'm getting is

setup called
setup called
test1
test2

I'm using factory_bot to create factories but the flow of execution of tests is wrong. Can someone point out what's wrong in this code.

Aucun commentaire:

Enregistrer un commentaire