jeudi 25 juin 2015

SimpleCov not recognizing/covering code from mixin

I have the following problem.

i have some models that share a mixing that includes some calculation algorithms.

there are plenty of tests i wrote that cover up all methods included in the mixin.

the code setup looks like this

# file in app/models
class MyModel < ActiveRecord::Base

  include MyMixin

end

# file in app/mixins
module MyMixin

  def calculate_all_the_things(*args)
    ...
  end

end


# file in test/models
class MyModelTest < ActiveSupport::TestCase

  test "should do things" do

    @model = MyModel.new

    assert @model.calculate_all_the_things(*args)

  end


end

the code works perfectly fine, tests are running but i never get any coverage for the module file. it is listed in my coverage file list, showing 4% coverage.... regarding the tests i wrote it should be about 80%....

I am trying to figure out how the coverage is been calculated and if might need to restructure things to get the coverage.

Aucun commentaire:

Enregistrer un commentaire