mardi 13 mars 2018

How to pass argument to subject in rspec

I have one subject block which i want to reuse in varioius places.

subject(:stubbed_data) do

expect(response.body).to eq(dynamic_var)

end 

The dynamic_var variable will be different for different test cases. is there any way to call subbed_data subject with arguments so that i can have dynamic value for dynamic_var variable.

Aucun commentaire:

Enregistrer un commentaire