1

this is my first time using RubyMine and I can't make the Test Framework recognize the tests.

If I run the greed.rb file it shows the result of the tests:

But if I run the tests it shows this:

I have read the question about minitest and tried to apply it to test-unit but it did not worked.

This is the content of my Gemfile:

gem 'test-unit', '~> 3.0.8'

And this is part of the ruby class that contains the tests:

require 'test/unit'

def score(dice)
  # code of the function
end

class Greed < Test::Unit::TestCase
    def test_score_of_an_empty_list_is_zero
      assert_equal 0, score([])
    end
end

I'm probably missing something but I haven't been able to find a solution.

Community
  • 1
  • 1
moondaisy
  • 4,303
  • 6
  • 41
  • 70

1 Answers1

0

To solve it I firstly restructured my project in the following way

/lib
  greed.rb
/tests
  test_greed.rb
Gemfile

Then I moved all of my tests to the new file

require './lib/greed.rb'
require 'test/unit'

class Test_Greed < Test::Unit::TestCase
# code for the tests
end

Finally I went to File/Setting/Project/Project Structure and marked the tests folder as Test (this should change the color of the folder icon).

Now I can run the tests using the testing framework

moondaisy
  • 4,303
  • 6
  • 41
  • 70