Setting Up the App and Initial Test

How the video lesson works You will code along with Josh as he builds the application. Do what he does, pause the video if you need to catch up or explore something further. Hop into the chat room to ask questions as you have them, or send emails...
This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/setting-up-the-app-and-initial-test

Mine was just a little bit slow as well, but my computer is older.

Perhaps you forgot to use the -T flag when you first generated your rails app which could now be causing your test to run slower.

Hope this helps, if you find out another reason why your test are running slow please reply with the answer.

Same here, do you get this warning in bash?
ā€œWarning: Youā€™re using Rubygems 1.8.23 with Spring. Upgrade to at least Rubygems 2.1.0 and run gem pristine --all for better startup performance.ā€

1 Like

I got that message.

This is what I did:

gem update --system
gem pristine --all

That worked for me.

Why Iā€™m getting this error

Enriques-MacBook-Air:goldtrex enriquesalceda$ rake
/Users/enriquesalceda/.rbenv/versions/2.2.0/bin/ruby -I/Users/enriquesalceda/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.1/lib:/Users/enriquesalceda/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-support-3.2.2/lib /Users/enriquesalceda/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
No examples found.


Finished in 0.00046 seconds (files took 0.10208 seconds to load)
0 examples, 0 failures

Iā€™m trying to implement testing on my app, I followed al the steps on the video, and I have a simple test to run. But itā€™s not working.

Hi guys,

My bad, I just fixed this problem, there were a few typos.

Thanks.

deleting my comment- as no longer makes sense.

My tests are really slow

The following is just for the smoke tests.

Finished in 0.20353 seconds (files took 4.09 seconds to load)

The only thing I did different was use postgresql as my DB. Could it be slowing me down that much?

Just to note, rake informed me that I was missing schema.rb and that I needed to run rake db:migrate in order to generate it. After I did that, my test passed.

@edgenard, fwiw, postgres is not the problem - Iā€™m running the default sqlite3 and getting comparable run times. I suspect those with blazing test times are on SSDā€™s with a full pack of memory (+8GB). Iā€™m running with 4GB on HDD.

Just wanted to mention that the powered by wistia chrome on the video often obscures what is being typed in.

I noticed this as well and quickly realized it was because I use dual monitors and was leaving the cursor on the secondary monitor. If you leave your cursor on the monitor playing the video the Wistia logo and scrub bar will disappear.

Thanks. That explains it. I was casting it to my TV with Chromecast.

Just like @edgenard my tests are running pretty slow. Iā€™m not using postgres, so I donā€™t have any clue on why my tests are traking 4 seconds or more to load.

Finished in 0.00204 seconds (files took 4.12 seconds to load)
1 example, 1 failure

According to Kent, we should not write any production code without seeing a failing test. What made you write the Todo model ? The failing test didnt ask you to do that. How are you making your architecture independent of the framework/UI? Todo is a very small app so tests run fast but if the app is pretty huge. I have tried it and gave up on testing because it was impossible to have my browser go through all the UI elements making the tests very slow.

Junior developers often change the text of the webpage resulting the tests to fail. Can we keep the dependency on the UI to the bare minimum? @joshuaclayton

Hello, which version of rails is this tutorial for? My config files and Gemfile are different
and rake command exits with error.

@evgenyfadeev

Hi there.

Around 2:44 in the video, you can see the final Gemfile. Rails 4.1.1 is being used. I am using Rails 5.0.2 myself, and whatever versions of RSpec and Capybara that Bundler chose to install (if I didnā€™t have them before, then the latest).

I tried running ā€˜rakeā€™ and got this error:

NoMethodError: undefined method `last_commentā€™ for #Rake::Application:0x007f8bfc254dd0

I googled it and learned that last_comment is not supported in rake versions > 11, so I added this to my Gemfile:

gem ā€˜rakeā€™, ā€˜< 11.0ā€™

Seems to work now. I hope this helps if others have the same problem.

1 Like

If you are having this error
NoMethodError: undefined method last_comment for ...
on rails 5.2,
use rspec-rails version 3.5. On your gemfile add the
gem 'rspec-rails', '~> 3.5', '>= 3.5.2'

There is an incompatibility between newer versions of rails (5.x) and the older version of rspec that this video instructed you to install. Youā€™ll have to update rspec-rails to > 3.5.0 to get things working again.

1 Like