Warm tip: This article is reproduced from stackoverflow.com, please click
cucumber fixtures rspec ruby-on-rails

Rails and Cucumber with Fixtures is not loading changes in Fixtures

发布于 2020-05-01 18:17:05

I have created fixtures located in spec/fixtures/ directory. I am running my Cucumber tests without any problem until I needed to change a value in my fixtures, but I cannot see the changes when I run the test. I am running using:

cucumber features/my_feature_cucumber.feature

I tried also:

bundle exec cucumber features/my_feature_cucumber.feature

and I am using byebug to verify the contents in the database.

All the time in has the same data as though there were no changes in the fixtures. I am losing something about the way it is loaded in every execution?

Questioner
Eduardo
Viewed
55
Eduardo 2020-02-13 11:25

Ok, maybe it was a silly question, but I would like to share the answer in case anyone else face this scenario in the future.

The answer is in the fixtures itself. They are created under spec directory, which means they are part of Rspec. Cucumber uses it but he doesn't reload them. So the way to see the changes reflected in Cucumber is simple executing Rspec, he will make the reloads.

rspec

or

bundle exec rspec

works to see the changes reflected in Cucumber.