I created a class with the method two_fer
(line# 6) in it but am still getting ‘NoMethod’ error. Perhaps someone can spot something I missed?
Thanks a lot!
user@debian:~/programming/exercism.org/ruby/two-fer$ ruby --verbose -r minitest/pride two_fer_test.rb
Run options: --seed 49602
# Running:
SSE
Error:
TwoFerTest#test_no_name_given:
NoMethodError: undefined method `two_fer' for TwoFer:Class
assert_equal "One for you, one for me.", TwoFer.two_fer
^^^^^^^^
two_fer_test.rb:7:in `test_no_name_given'
rails test two_fer_test.rb:5
Finished in 0.004945s, 606.6500 runs/s, 0.0000 assertions/s.
3 runs, 0 assertions, 0 failures, 1 errors, 2 skips
You have skipped tests. Run with --verbose for details.
user@debian:~/programming/exercism.org/ruby/two-fer$
user@debian:~/programming/exercism.org/ruby/two-fer$ cat -n two_fer.rb
1 class TwoFer
2 #def initialize(name)
3 # @name=name
4 #end
5
6 def two_fer(name=nil)
7 if name
8 p "One for #{name}, one for me."
9 else
10 p "One for you, one for me."
11 end
12 end
13 end
user@debian:~/programming/exercism.org/ruby/two-fer$
user@debian:~/programming/exercism.org/ruby/two-fer$ cat -n two_fer_test.rb
1 require 'minitest/autorun'
2 require_relative 'two_fer'
3
4 class TwoFerTest < Minitest::Test
5 def test_no_name_given
6 # skip
7 assert_equal "One for you, one for me.", TwoFer.two_fer
8 end
9
10 def test_a_name_given
11 skip
12 assert_equal "One for Alice, one for me.", TwoFer.two_fer("Alice")
13 end
14
15 def test_another_name_given
16 skip
17 assert_equal "One for Bob, one for me.", TwoFer.two_fer("Bob")
18 end
19 end