Skip to content

Instantly share code, notes, and snippets.

@fredlee
Created June 19, 2010 21:55
Show Gist options
  • Save fredlee/445318 to your computer and use it in GitHub Desktop.
Save fredlee/445318 to your computer and use it in GitHub Desktop.
require 'minitest/unit'
MiniTest::Unit.autorun
require './data_processor'
require 'yaml'
require './employee_data'
class TestDataProcessor < MiniTest::Unit::TestCase
def test_reading_first_employee
y = YAML::load_file('payroll_data.yml')
employee = y[:employees][1]
assert_equal EmployeeData.new(employee).first_name, "Makenna"
assert_equal EmployeeData.new(employee).last_name, "Kautzer"
end
end
class EmployeeData
def initialize(employee_hash)
@first_name = employee_hash[:first_name]
@last_name = employee_hash[:last_name]
end
attr_reader :first_name
attr_reader :last_name
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment