marina
marina

Reputation: 21

How to fix Capybara/Cucumber running outdated code?

I'm testing a feature using Cucumber and Capybara (with poltergeist/phantomjs). The problem is that changes that I make to my code are not being reflected in the tests. My tests are failing because I changed the name of a link, if I take a screenshot of the page on the test I can see that it still shows the old link, but if I navigate to the page on my browser, it shows the correct one. I have been trying to solve this since yesterday with no luck. I don't even know which code would be relevant to paste here, has anyone had this problem or has any idea of what this could be?

Thank you!


UPDATE

I was able to fix this by running rails generate cucumber:install again. Doing this updated the page on the test. But then I modified the page again and once more it's outdated on the test, running the cucumber:install command is not helping anymore either.

Upvotes: 2

Views: 185

Answers (2)

Miguel Salas
Miguel Salas

Reputation: 701

You should run rake assets:precompile RAILS_ENV=test and that will regenerate the code that capybara will run.

Upvotes: 0

Fedcomp
Fedcomp

Reputation: 2425

Are you using guard for auto tests? try

spring stop

it will restart spring preloader. Sometimes it fails to update test code/application code

Upvotes: 1

Related Questions