Just after some clarification on how simplecov determines if a line has been exercised by a test.
I have the following method:
def over?
end_at < Time.zone.now
end
in which end_at is an ActiveRecord attribute on the object.
Which is exercised in the following spec:
describe CalendarEntry do
it 'can determine that an event has ended' do
@entry.end_at = 1.day.ago
@entry.over?.should be_true
end
end
After running the spec with coverage, it shows the following result:
I've run the test in debug mode with a break point on this line and confirmed that the spec is indeed hitting it.
This isn't isolated to just this line in this method, every line that includes the use of an ActiveRecord associated getter is shown as not covered. Could be coincidence, but seems a bit odd.
Environment: ruby 1.9.3-p327 (mri), rails 3.2.8, simplecov 0.7.1, rspec 2.10.0.
Any ideas on why simplecov thinks it's not covered?
over?
? That could explain the method being hit, but not all the results for that code being tested. – Paul Fioravanti@entry
is defined and what thesubject
of the test is. – Paul Fioravanti