How to write your first acceptance test

Rubyists always talk about testing. The growth of Ruby (and Rails) came at a time when automated testing and agile development also came to the fore. And much of the flexibility around agile depends upon being able to safely make changes to your development plan after the project has started. But testing is not easy…. Continue reading

The easy way to get started with automated testing

You love Ruby. A beautiful language, object orientated with a light sprinkling of functional features. The community is nice. But there’s a nagging doubt in the back of your mind. Real Rubyists use tests TDD, BDD, RSpec, Capybara … you’re not a rubyist if you don’t write tests. That’s what the cool kids say. And… Continue reading

Rails on Windows: total frustration!

You’re all excited. You’re working your way through various Rails tutorials, following the instructions to the letter. But nothing seems to go smoothly. The bloody thing won’t do what it’s supposed to do bundle install just throws weird errors at you. bundle update doesn’t help. You’ve even resorted to editing the Gemfile.lock by hand in… Continue reading

2 things every ActiveRecord model needs to know

If you’re an ActiveRecord model, life’s pretty easy. Find yourself here, save yourself there, validate yourself every now and then. But there are two questions that every ActiveRecord model needs to know the answer to, otherwise they find that they’re just that bit awkward when dealing with the outside world. The first is pretty easy… Continue reading

What does “bundle exec” mean?

Getting started with Ruby and Rails is quite different to many other programming environments. Instead of starting with an IDE and something visual to build on, you’re left at a command line with a plain text editor. If you’re not familiar with this style of development it can seem pretty confusing, some of the commands… Continue reading

How can I store application secrets without keeping them in my source code?

I’m using AWS and I need to store my credentials securely. I’ve heard that I should store them in the environment which is something to do with the program that’s running. I’ve also tried putting it in an initialiser but couldn’t figure out how to access it from my controllers. When you have important secrets… Continue reading

What’s the best way to automate actions in my ruby project?

I want to set up an email alert based on a user-given date (I have a “valid-to” variable and I want to send an email alert a few days before the expiry); is there a gem that can do that? Assuming you’re using a Unix-like system (which for most Ruby programmers is the case, there’s… Continue reading

Switching from RSpec to Minitest

I like the “specification” style of testing – it makes more sense to me than the “assertion” style. But I’ve recently switched from RSpec to Minitest (with Mocha). Why? RSpec is huge. It makes lovely tests that read like English, but it’s huge. Plus its recent switch from object.should == something to expect(object).to be ==… Continue reading