Skip to content

Instantly share code, notes, and snippets.

@mmower
Created November 24, 2009 21:38
Show Gist options
  • Save mmower/242251 to your computer and use it in GitHub Desktop.
Save mmower/242251 to your computer and use it in GitHub Desktop.
describe "Hospital Patient Chart" do
it "should have heart rate information" do
# heart rate information is numeric
# so it should be represented as a number
# it's implied that it's beats per minute
# (unless you're going to be storing it in
# some other format elsewhere)
HospitalPatientChart.new( 75 ).heart_rate.should == 75
end
end
class HospitalPatientChart
# We don't obviously need a setter so I've used attr_reader.
attr_reader :heart_rate
def initialize(heart_rate)
@heart_rate = heart_rate
end
end
# It's a patients chart so likely to be their heart rate
patient_chart = HospitalPatientChart.new( 75 )
puts patient_chart.heart_rate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment