debian-mirror-gitlab/spec/lib/gitlab/sherlock/file_sample_spec.rb

57 lines
1.2 KiB
Ruby
Raw Normal View History

2019-12-04 20:38:33 +05:30
# frozen_string_literal: true
2015-11-26 14:37:03 +05:30
require 'spec_helper'
2017-09-10 17:25:29 +05:30
describe Gitlab::Sherlock::FileSample do
2015-11-26 14:37:03 +05:30
let(:sample) { described_class.new(__FILE__, [], 150.4, 2) }
describe '#id' do
it 'returns the ID' do
expect(sample.id).to be_an_instance_of(String)
end
end
describe '#file' do
it 'returns the file path' do
expect(sample.file).to eq(__FILE__)
end
end
describe '#line_samples' do
it 'returns the line samples' do
expect(sample.line_samples).to eq([])
end
end
describe '#events' do
it 'returns the total number of events' do
expect(sample.events).to eq(2)
end
end
describe '#duration' do
it 'returns the total execution time' do
expect(sample.duration).to eq(150.4)
end
end
describe '#relative_path' do
it 'returns the relative path' do
2017-09-10 17:25:29 +05:30
expect(sample.relative_path)
.to eq('spec/lib/gitlab/sherlock/file_sample_spec.rb')
2015-11-26 14:37:03 +05:30
end
end
describe '#to_param' do
it 'returns the sample ID' do
expect(sample.to_param).to eq(sample.id)
end
end
describe '#source' do
it 'returns the contents of the file' do
expect(sample.source).to eq(File.read(__FILE__))
end
end
end