I am still working through tutorials, but I have my sample app up on github. Previously, I had it set up with guard/spork etc, and have about 49 tests written. Last time I used it, everything worked fine and passed. I did a push to github and all was well.
Since then, I have had to reinstall the OS on my computer (Ubuntu 12.10), and I have finally got Sublime Text 2, rvm, rails etc installed. After all of that, I cloned my app into the directory I wanted. Then I used “bundle install”, as I have read needed to be done. Next, I tried to run my tests (this time without guard/spork) so I just ran “bundle exec rspec spec”. The terminal window freezes for about 30 seconds and then spits out an output saying that every one of my tests has failed.
My application and directory structure is identical to what it was in my previous OS. What could be causing this to happen?
I think There’s a problem with my database. It looks like the majority of my tests say “could not find table ‘users’”. I have tried “rake db:setup” and “rake db:migrate” but no luck.
Thanks!!!
Thanks for the reply. I tried that, although I am still having the same troubles. Also, now when I type “bundle exec rspec spec” I enter the command and then the terminal hangs completely frozen for almost a full minute before the tests are actually ran. However, when the tests finally do run, it reports they finished in just .4 seconds.
Something is truly off here. Do I need to reinstall RVM? Would that be a good idea?
You might try creating a dummy app and see how it fairs. If you have a system wide problem (which is likely, because you said you reinstalled OS), then you will get similar results.
Ah - I performed “rake db:test:prepare” and now my tests are passing. However, it still takes over a minute for an rspec spec test to even begin. I wonder what is causing the hang up?
Rails is causing the hang up. One must stop auto requiring everything
via bundler and start managing things a bit more manually, that is,
unless you like waiting 10 minutes for Rails to figure out what the
hell it's going to do and then do it. What I am saying is, we've
managed to get our apps from taking a minute to load to loading almost
instantly by setting require:false on almost everything and then
manually requiring as we need it.
Interesting to read, although at this point I am using exactly the same setup (cloned from git) that I was using two days ago, and then the tests ran almost instantly. I think your wisdom will probably be more applicable as I move forward in my rails career
I think There's a problem with my database. It looks like the majority of my
tests say "could not find table 'users'". I have tried "rake db:setup" and
"rake db:migrate" but no luck.
If you look at the database using an alternative method of access
(dependent on database type) is the users table there?
Well, I ended up solving the problem. After doing the things stated in this thread, and many other things found online with no success, I rebooted my computer. When it booted up, Ubuntu told me it was running in low graphics mode etc. Then, I rebooted again, came up normally, and then my tests ran just fine. I think something was hosed up with my OS.
Well, I ended up solving the problem. After doing the things stated in this
thread, and many other things found online with no success, I rebooted my
computer. When it booted up, Ubuntu told me it was running in low graphics
mode etc. Then, I rebooted again, came up normally, and then my tests ran
just fine. I think something was hosed up with my OS.
You might want to run some hardware tests, all the same...