LCPGM
LCPGM

Reputation: 21

Rspec tests uses some different (presumably old) files

I'm dealing with the huge problem during RSpec and capybara testing. In development mode, everything works as intended, but when it comes to tests, RSpec uses some different (presumably old) files.

I noticed the difference between test and development output in the same scenario while testing. I've made some research and found that RSpec doesn't use the same files as rails server in development mode. I've come to this by changing render page to render "hello". On rails development server it printed out "hello" on the page, but on tests, the page was the same as before making changes in rendering.

First I thought that's the problem with cache and temporary files, so I deleted it all, but I don't work. Do you have any ideas why my test RSpec is using other(old) instead of my application files? I've also tried to run RSpec tests in the development environment, but it still doesn't use correct files.

Upvotes: 1

Views: 396

Answers (1)

Douglas Mendes
Douglas Mendes

Reputation: 322

I was using Intellij IDEA and the project was set to put compiled (which is funny considering it's Ruby) files in an "out" folder.

Project Settings > Project > Project compiler output.

When I deleted this "out" folder and ran rspec . in the base directory of the project, all worked fine.

So pay attention to the spec file path failing. It might show you it's in an "out" folder or similar.

Upvotes: 1

Related Questions