How do I compare two integer value hashes?
Here's a version that is a bit more DRY. It also makes use of ruby's default value for hashes, and I threw in a dummy class in order to make the tests actually run.

This could probably be done even better, but one thing you really should try to achieve when writing ruby code (or any code at all, for that matter) is to try not to repeat yourself too much. That's where DRY come in.

class CostCalculation
  attr_accessor :wood, :stone, :gold

  def initialize(reqs)
    self.wood = reqs[:wood] || 0
    self.stone = reqs[:stone] || 0
    self.gold = reqs[:gold] || 0
  end 

  def has_resources?(cost)
    report = Hash.new(true)
    cost.default = 0 

    attributes.each do |key, value|
      report[:"has_#{key}"] = cost[key] &lt;= value
    end 

    if report.values.include?(false)
      report[:has_resources] = false
    end 

    report
  end 

  def attributes
    { wood: self.wood, stone: self.stone, gold: self.gold }   
  end 
end


...and here are some specs for it as well:

describe CostCalculation do
  it "has enough resources for something that's free" do
    report = CostCalculation.new({}).has_resources?({})
    report[:has_resources].should == true
  end 

  %w[wood stone gold].each do |resource|    
    it "does not have enough resources if #{resource} is missing" do
      cost = {resource.to_sym =&gt; 1}
      report = CostCalculation.new({wood: 0, stone: 0, gold: 0}).has_resources?(cost)

      report[:has_resources].should == false
      report[:"has_#{resource}"].should == false
    end 
  end 
end