Skip to content

Instantly share code, notes, and snippets.

@mariochavez
Created July 12, 2013 15:55
Show Gist options
  • Save mariochavez/5985510 to your computer and use it in GitHub Desktop.
Save mariochavez/5985510 to your computer and use it in GitHub Desktop.
require 'minitest/autorun'
class Tea
def initialize(kind)
@teas = { green: 150 }
@kind = kind
end
def temperature
@teas[@kind]
end
end
class TeaTest < Minitest::Unit::TestCase
def test_green_tea_temperature
hot_tea = Tea.new :green
assert(hot_tea.temperature == 150)
end
def test_green_tea_temperature2
hot_tea = Tea.new :green
assert_equal 150, hot_tea.temperature
end
end
class Minitest::Spec
class << self
alias :context :describe
end
end
describe Tea do
context 'Green tea' do
subject { Tea.new :green }
it 'temperature should be right' do
subject.temperature.must_equal 150
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment