Skip to content

Scope is considerated "not ok" by simplecov-rcov when it is divided in two lines #16

@robsonagapito

Description

@robsonagapito

I have a code and I declare a scope, as line bellow:

scope :with_snapshot_histories,
-> { where(SCOPE_STR) }

In this case simplecov-rcov return "NOT OK", but if I declare scope in one line the result becomes OK.

scope :with_snapshot_histories, -> { where(SCOPE_STR) }

This situation also happens when I have a block (bellow):

NOT OK:
scope :service_codes_by_login, (lambda do |login|
joins(:account)
.where(accounts: {login: "#{login}/#{login}"})
.select(:service_code)
end)

OK:
scope :service_codes_by_login, (lambda do |login| joins(:account).where(accounts: {login: "#{login}/#{login}"}).select(:service_code) end)

Is this a problem? Or is this a expected comportment?

This situation affect the result of our coverage.

Code in 2 lines:
simplecov-rcov_before_perc

Result (2 lines) - 85.58% / 73.03 :
simplecov-rcov_before_code

Code in 1 line:
simplecov-rcov_after_code

Result (1 line) - 85.64% / 73.15%
simplecov-rcov_after_perc

Coverage's difference:
Result (2 lines) - 85.58% / 73.03%
Result (1 line) - 85.64% / 73.15%

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions