Today I wrote my first set of ‘subject’ tests for a pretty simple model. These tests are fast, clean, and easy to read. I wrote up a basic example to demonstrate and share some knowledge.

Super simple model:

class MailingAddress
 attr_accessor :name, :street, :city, :state, :zip

 def initialize(args)
  self.name = args[:name]
  self.street = args[:street]
  self.city = args[:city]
  self.state = args[:state]
  self.zip = args[:zip]
 end
end

Now some super simple tests:

describe MailingAddress do
 context "when passed valid arguments" do
   subject do
    MailingAddress.new(
     :name => "Matic",
     :street => "Test St.",
     :city => "Some City",
     :state => "CA",
     :zip => "90210",
   )
 end

  its(:name) { should == "Matic" }
  its(:street) { should == "Test St." }
  its(:city) { should == "Some City" }
  its(:state) { should == "CA" }
  its(:zip) { should == "90210" }
 end
end

Uhhhhh…yes, please. I understand that these simple tests aren’t really testing anything too substancial, but it’s not like they are limited to the expected behavior of arguments. The possibilites of drying up legacy code are ENDLESS 😀

Posted on by Matic | Comments Off on ‘Subject’ RSpec Tests are K3WL

Dear Recruiters

I am not a ninja. My profession does not require me to throw asterisks at ‘code samurais’. I do not practice RSpec in a dojo. My boss does not wear tabi shoes. I do not lurk in the shadows of legacy code. Telling me that I have the opportunity to work with ‘other talented ninjas’ does not make me want to move to a new company. You will find that most engineers find it degrading to their profession. By no means am I saying that I don’t enjoy some childish amenities in my office but that is no excuse to belittle my craft and my livelihood.

ninja != software_engineer

Posted in Ruby | Comments Off on Dear Recruiters

Your Culture Makes the Job

Working in a professional environment is great and all if that is what suits you, the truth of the matter is that it doesn’t suit everyone. Just because you don’t prefer to wear a suit and tie doesn’t mean that you don’t have an education, although it certainly seems to project that. We are entering an era of t-shirts, tattoos, and piercings in the work place. If you prefer to be old-school there are jobs out there for you, if you prefer working in a diversified environment with outlandish and exuberant people there are jobs for you as well. If you do not fit into the culture of the company you are interviewing for, chances are that you will change or the company will change…either way, a lot of people are going to be pissed. Work where you are comfortable with people that you will enjoy and NEVER settle for anything less.

Posted in Ruby | Comments Off on Your Culture Makes the Job

Getting Through the Grunge

Now I am no expert, but I am trying to learn. One thing that has been key to my success is doing the shit work that no one else wants to take on. When you are learning to program in ANY language, pile on that grunt work that no one else wants to do. Generally the reason they don’t want to do it is because it is awful and boring work that lacks challenge…here is the kicker though; you are learning to be a code janitor and this benefits everyone. YOU are taking on the work that no one else wants to do (coworkers happy). YOU have so much work that you no longer float around looking for things to fill your afternoon (boss sees you are busy, they’re happy). And the icing on the cake? YOU are learning the basic things that will be the building blocks for your success at that company. You will find yourself aquiring more and more grunge work and you should accept it with open arms. So quit your bitching and put a smile on because whether you realize it or not, you are single handedly improving the quality of life of multiple coworkers and learning all in the same short amount of time.

Posted in Ruby | 1 Comment

My War on the Box…

I read an interesting quote the other day that I felt could be applied to programming in general. It stated “Think inside the box.” Those words have been bouncing around in my brain for a week now and I feel like I can finally quantify why that hit me like a freight train. When I was in elementary school there was a doodle that we had to create where we used 6 straight lines to create a house, the lines could not cross over each other and you couldn’t go back over a line already drawn. We did puzzles like this from that day on and we were told “…think outside of the box.” Since the era of when girls had cooties, I have been taught this semi-abstract method of thinking about concepts with a third-person perspective. So this idea of “thinking inside the box” gave me a headache to try and figure out why it is such a good concept. Without giving away all of the details, think about it…ponder why thinking inside the box might be more constructive than trying to be so abstract. Ask yourself, “What is this ‘box’ we are told to think about? And why must we think outside of it?”

Posted in Ruby | Comments Off on My War on the Box…

Coding with Cappuccinos…

So, it has been a while since I have posted anything. I have been a busy newb and progressed quite a bit since my last entry. Early this year (2011) I attended my first technology related conference, it is a ruby conference held in LA every year. This year they were having classes to teach you some basic ruby and rails, at this conference I had signed up to take a class each day and to attend the speeches on the final day. The first class was Ruby Koans, an app built completely in ruby to run in your terminal and guide you to have a basic understanding of ruby. The really nice thing about this Koans class is that it also teaches about the error messages (that will inevitably haunt your dreams), what they mean, and how to sift through your code to find them. The next class was for ruby on rails, it follows a tutorial written by Michael Hartl called Ruby on Rails Tutorial. The entire tutorial can be found online for free and is completely awesome, I purchased the screen casts and I see it as money well spent. I would like to warn all everyone by saying that this information is dense, I got through it by periodically taking video game and coffee breaks…very strong coffee. Without these mental breaks your eyes will gloss over like a donut and you will learn less than Charlie Brown did in school.

Posted in Ruby | Comments Off on Coding with Cappuccinos…

Brick by Brick…


Now, I am not much for reading. In fact, I stopped going to the library once my teacher told me I had to pick out a book that didn’t have pictures between the text (poor little me). However, this Learn to Program book I was finding quite enjoyable. I was learning to program from the ground up. I started with puts “Hello world!” and my computer would read back to me “Hello world!” I was fascinated and thoroughly addicted to reading about the next program to build. I was also intrigued by how simple it seemed to write code. Although these applications I was writing had no real world purpose, I looked at it like math; of course I will never use the Pythagorean theorem in my everyday life BUT its the process of the formula that sticks. This book isn’t going to teach you to be a six-figure programmer, but it will give you the framework for starting your city brick by brick.

Posted in Ruby | Comments Off on Brick by Brick…

One Brick…


My adventure starts in the biggest little city of Reno, NV. At the time I was working at a home improvement store for (probably what is less than) minimum wage. I had worked my way up to the proverbial glass ceiling and was maxed out in specializing in doors..or something like that. I didn’t hate my job but I hated that it was going nowhere at a tremendously alarming pace. That’s when I picked up Learn to Program (by Chris Pine) and dove into learning a computer language. Now, I have never done any sort of computer language, except for maybe the one to make your social networking page look “really frickin’ cool”, so I figured that just jumping in to learning computer lingo would be more of a difficult task than it has turned out to be (but by no means am I saying it is easy). I like to imagine learning to program is a city, and just like any city…you start with one brick.

Posted in Ruby | Comments Off on One Brick…