Created
June 19, 2010 21:55
-
-
Save fredlee/445318 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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