BigW Consortium Gitlab

metrics_spec.rb 504 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
require 'spec_helper'

describe MergeRequest::Metrics, models: true do
  let(:project) { create(:project) }

  subject { create(:merge_request, source_project: project) }

  describe "when recording the default set of metrics on merge request save" do
    it "records the merge time" do
      time = Time.now
      Timecop.freeze(time) { subject.mark_as_merged }
      metrics = subject.metrics

      expect(metrics).to be_present
15
      expect(metrics.merged_at).to be_like_time(time)
16 17 18
    end
  end
end