Created
July 12, 2013 15:55
-
-
Save mariochavez/5985510 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/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