colszowka/simplecov — Issue #110: Tested code isn't being marked covered
Author: andrerpbts
Created: 2012-01-31 23:39:51+00:00
State: open

Hi, I don't know if I'm doing something wrong, but I have a model with two methods, and even the test passing, the coverage file isn't being marked as covered.

#model
class List < ActiveRecord::Base
def closed?
self.status == 'closed'
end

def open?
self.status == 'open'
end
end

#test
require 'test_helper'

class ListTest < ActiveSupport::TestCase
test "should respond true to the closed? method" do
list = create(status: 'closed')
assert list.closed?, "a closed list is not responding true to closed? method"
end

test "should respond true to the open? method" do
list = create(status: 'open')
assert list.open?, "a opened list is not responding true to open? method"
end

private
def create(options={})
List.create({
description: 'Test list',
status: 'open'
}.merge(options))
end
end

the return of method open? isn't being covered. Why?