I don't quite understand why my test isn't running. It works if I include it in the calc.rb file. However, when I split the test up and try and run it in the test_calc.rb the file does not run. And I get the following error:
/.rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from test_fall.rb:6:in `<class:TestAdd>'
from test_fall.rb:4:in `<main>'
I don't quite understand why it's looking in the 2.1.4 directory for the file.
calc.rb
class Calc
def add(a, b)
a + b
end
end
test_calc.rb
require 'calc.rb'
require 'minitest/autorun'
class TestAdd < Minitest::Test
def test_add
calc = Calc.new
expected = calc.add 3,2
assert_equal expected, 5
end
def test_add_bigint
calc = Calc.new
val = calc.add 10000000, 10000000
assert_equal val, 20000000
end
end