Author Archives: dudekpj

Vagrant Virtual Machine with Puppet for Rails

When I first started trying to learn Ruby on Rails, I noticed that there seemed to be a lot of steps, apt-gets, and other hoops and obstacles I had to tackle prior to getting my first “rails server” command to successfully fire up localhost:3000 with my rails application. I remember thinking to myself, if this is how hard it is to set up a workstation to run rails, then I’m not too sure it’s going to be all that pleasant to work with.

In particular, I realized that in a team setting, having to configure multiple workstations for each developer would be less than awesome. Yuck!

Enter VirtualBox and Vagrant. VirtualBox is a free Oracle product that allows developers to add virtual machine instances to their local operating system install. Vagrant is essentially a way to download an instance of an operating system, such as Precise32, and fire up a VirtualBox virtual machine on the fly in accordance to a specified config file.

Continue reading

Tagged , , ,

Factory_Girl Validation Trouble

I ran into a dilemma with one of my rspec controller test suites while working on a personal website with book and author models.

It occurred as I was using the amazing factory_girl gem, which allows me to pre-define the attributes for a model into a factory to be used over and over again throughout my test suite. That way any time I need to fire up a test instance of a particular model, I can very easily with code like:

Continue reading

Tagged , ,

Using RSpec in Rails

As a ruby on rails developer, I’d like to promote the need for testing your applications. No matter how small or large your project, tests will be an invaluable tool to ensure working functionality as you add, delete and refactor code. And I can promise you, during the lifespan of your web app, your code will remain far from static. This is very obvious when you are working for a client. They change their minds constantly. But even if YOU are the client, as I have found myself to be as I work on my own, hobby rails sites, I’ve discovered that even I cannot resist the urge to make changes to my site, some that often break past functionality.

Continue reading

Tagged ,