Accidental Technologist

Musings about Entrepreneurship, Technology and Software Development

  • Home
  • About
  • Still River Software
  • Privacy Policy

Powered by Genesis

Ruby on Rails Testing Resources

November 14, 2018 by Rob Bazinet Leave a Comment

Tweet

When taking the plunge into Ruby on Rails it’s really easy to get carried away with learning all about the framework. It’s easy to learn the fundamentals and later realize the Rails community is a community of testers. It’s a strange world when you set out to learn about testing, TDD (test-driven development), BDD (behavior-driven development) and other acronyms and phrases relating to testing Ruby on Rails applications.

I decided to put together a short list of helpful resources to get started. If you have suggestions that would be useful to be added to this list, please add a comment or email me directly and I’ll update this post.

Books

  • Everyday Rails Testing with RSpec – this is a great, hands-on, roll-up your sleeves and get-to-work book. If you want to use RSpec on a daily basis, this book gives great advice on how to use RSpec in your day-to-day routine. It’s kept up-to-date with latest RSpec too.
  • Rails 5 Test Prescriptions – I use this book as a reference I often go to. It’s been updated to from previous versions to now Rails 5 and is a great tool to have on the shelf.
  • Effective Testing with RSpec 3 – if you decide you’d rather start without worrying about all the details around Rails you can start with learning RSpec with plain Ruby and help yourself. I’ve been through this one cover-to-cover and it’s a great tutorial.
  • The Minitest Cookbook – if you decide RSpec isn’t for you, this is probably the ultimate resource for Minitest. Well-written and kept up-to-date.

Podcasts

You can’t really learn testing from a podcast but you can learn how others approach the craft. The first is a podcast dedicated to testing Ruby applications. The rest is a list of a few episodes of podcasts that discussed testing.

  • The Ruby Testing Podcast
  • Ruby Rogues 385: “Ruby/Rails Testing” with Jason Swett
  • Ruby Rogues 269 Testing
  • Full Stack Radio 46: Joe Ferris – Test Driven Rails

I’ve been listening to The Ruby Testing Podcast and picked up some nice tidbits so far.

Training

I love Pluralsight.

  • RSpec the Right Way
  • Test-driven Rails with RSpec, Capybara, and Cucumber

Xavier Shay has long been involved in the Ruby community and well-known for discussions around testing. One of his best blog posts explains his approach to testing.

  • Testing Ruby Applications with RSpec

I’ve taken several courses on Udemy and they are one of my favorite places for training. The prices are low and there are many courses, so you have to do a bit of work to see which course is right for you but well worth the effort.

  • The Complete TDD Course: Master Ruby Development with RSpec
  • Ruby on Rails 5 – BDD, RSpec and Capybara

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby on Rails Tagged With: bdd, minitest, rspec, Ruby on Rails, tdd, unit testing

Minitest Not Running My Unit Tests

September 17, 2012 by Rob Bazinet 2 Comments

Tweet

I have started using minitest for Rails 3.x unit testing and since it comes with Ruby 1.9.x by default, it seems like a good direction to take my testing.

I am using the great gem by Mike Moore called minitest-rails which has a minitest dependency so I can easily have the latest version of minitest. ?This gem helps to more cleanly integrate and use minitest in our Rails 3.x projects.

As part of my setup I use Autotest so my tests run automatically when files change. ?I noticed none of my unit tests were running and upon further inspection, minitest was looking in test/unit and test/unit test directories but not in the test/models folder, which seems to be the minitest default. ?

Opening up my .autotest configuration file and adding the following:

Autotest.add_hook :initialize do |at|
?at.add_mapping(/test\/models\/.*\.rb/) do |_, m|
??at.files_matching %r%^test/(models)/.*\.rb$%
?end
end

After restarting autotest, my unit tests are now being tested. ?I hope this saves someone some time.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby on Rails Tagged With: autotest, minitest, rails, Ruby, unit testing

Recent Posts

  • Status Bar in iTerm2
  • Supporting Multiple SSH Keys on macOS
  • Using the Microsoft Ergonomic Keyboard on macOS
  • 10 Steps to Survive Working from Home
  • “Are you building a business or learning a stack?”

Categories

Services I Love

HatchBox - Easy Rails Deploys Fathom Analytics
Follow @rbazinet

Rob Bazinet
@rbazinet

  • I unsubscribe from blogs that only show me a tiny part of the post and force me to visit the site.
    about 1 week ago
  • If anyone is looking for a seasoned .NET, C# and https://t.co/q7WzxhZnCZ developer, a good friend of mine has some… https://t.co/5DqXtCzySr
    about 2 weeks ago
  • Slack is down…2021 is looking up already.
    about 3 weeks ago
  • Subscribe to Locally Sourced by Noel Rappin by @noelrap https://t.co/yZnXfg2tU5
    about 1 month ago
  • So true! https://t.co/6axDZAHASZ
    about 1 month ago
  • RSS - Posts
  • RSS - Comments
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.