Sha256: 11a50ab0c7037da512b294d07d500ff36e0b25d1dab1e29fc43954a2dc2013cd
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
require 'helper' class TestSimpleCovHtml < Test::Unit::TestCase def test_format formatter = SimpleCov::Formatter::JSONFormatter.new result = mock() created_at = DateTime.now.to_s result.expects(:created_at).returns(created_at) result.expects(:command_name).returns('RSpec') result.expects(:original_result).returns({ '/lib/foo.rb' => [1, nil, 0, 0, nil, 1, nil], '/lib/bar.rb' => [nil, 1, nil, 1, 1, 1, 0, 0, nil, 1, nil], '/test/test.rb' => [nil, 1, 1, 1, 1] }) result.expects(:filenames).returns(['/lib/foo.rb', '/lib/bar.rb']) result.expects(:filenames).returns(['/lib/foo.rb', '/lib/bar.rb']) result.expects(:filenames).returns(['/lib/foo.rb', '/lib/bar.rb']) result.expects(:groups).returns(['controllers', 'models']) result.expects(:covered_percent).returns(73.33) result.expects(:covered_strength).returns(0.87) result.expects(:covered_lines).returns(11) result.expects(:total_lines).returns(15) result.expects(:command_name).returns('RSpec') result.expects(:covered_lines).returns(11) result.expects(:total_lines).returns(15) result.expects(:covered_percent).returns(73.33) assert_equal(formatter.format(result), { 'timestamp' => created_at.to_i, 'command_name' => 'RSpec', 'files' => [ {'filename' => '/lib/foo.rb', 'coverage' => [1, nil, 0, 0, nil, 1, nil]}, {'filename' => '/lib/bar.rb', 'coverage' => [nil, 1, nil, 1, 1, 1, 0, 0, nil, 1, nil]}, ], 'groups' =>['controllers', 'models'], 'metrics' => { 'covered_percent' => 73.33, 'covered_strength' => 0.87, 'covered_lines' => 11, 'total_lines' => 15, } }.to_json) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simplecov-json-0.1.1 | test/test_simplecov_json.rb |