summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/sherlock/file_sample_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-11-17 17:01:28 +0100
committerDouwe Maan <douwe@gitlab.com>2015-11-17 17:01:28 +0100
commit0b540a0fadf172277639910023fcf8b713ad35aa (patch)
tree9efe6d84cebdca7bc31bcc0e6e2e3b7bdf2e3185 /spec/lib/gitlab/sherlock/file_sample_spec.rb
parent3d50b99d016af91c06a40f7a8bf4c298e241220a (diff)
parentdf0110ba81a86b3e066c8b703e1c26d6d05a75da (diff)
downloadgitlab-ce-0b540a0fadf172277639910023fcf8b713ad35aa.tar.gz
Merge branch 'master' into dirceu/gitlab-ce-new-merge-request-from-file-edit
Diffstat (limited to 'spec/lib/gitlab/sherlock/file_sample_spec.rb')
-rw-r--r--spec/lib/gitlab/sherlock/file_sample_spec.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/lib/gitlab/sherlock/file_sample_spec.rb b/spec/lib/gitlab/sherlock/file_sample_spec.rb
new file mode 100644
index 00000000000..f05a59f56f6
--- /dev/null
+++ b/spec/lib/gitlab/sherlock/file_sample_spec.rb
@@ -0,0 +1,54 @@
+require 'spec_helper'
+
+describe Gitlab::Sherlock::FileSample do
+ 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
+ expect(sample.relative_path).
+ to eq('spec/lib/gitlab/sherlock/file_sample_spec.rb')
+ 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