Commit f8acc7ea authored by James Lopez's avatar James Lopez

fixing spec failures

parent d99cec7f
......@@ -13,7 +13,7 @@ module Gitlab
def issue_events
# TODO figure out what the frontend needs for displaying the avatar
@fetcher.fetch_issue_events { |event| parse_event(event) }
@fetcher.fetch_issue_events.each { |event| parse_event(event) }
end
def plan_events
......@@ -25,7 +25,7 @@ module Gitlab
end
def code_events
@fetcher.fetch_code_events { |event| parse_event(event) }
@fetcher.fetch_code_events.each { |event| parse_event(event) }
end
def test_events
......@@ -39,13 +39,13 @@ module Gitlab
@fetcher.fetch_review_events.each { |event| parse_event(event) }
end
private
def parse_event(event)
event['total_time'] = distance_of_time_in_words(event['total_time'].to_f)
event['created_at'] = interval_in_words(event['created_at'])
end
private
def first_time_reference_commit(commits, event)
st_commit = YAML.load(commits).detect do |commit|
commit['created_at'] == event['first_mentioned_in_commit_at']
......
......@@ -8,7 +8,7 @@ module Gitlab
# Note: For MySQL, the interval is returned in seconds.
# For PostgreSQL, the interval is returned as an INTERVAL type.
def subtract_datetimes(query_so_far, start_time_attrs, end_time_attrs, as)
diff_fn = subtract_datetimes_diff(query_so_far, end_time_attrs, start_time_attrs)
diff_fn = subtract_datetimes_diff(query_so_far, start_time_attrs, end_time_attrs)
query_so_far.project(diff_fn.as(as))
end
......
......@@ -78,10 +78,12 @@ describe Gitlab::CycleAnalytics::Events do
describe '#test_events' do
let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
let(:merge_request) { MergeRequest.first }
let!(:pipeline) { create(:ci_pipeline,
ref: merge_request.source_branch,
sha: merge_request.diff_head_sha,
project: context.project) }
let!(:pipeline) do
create(:ci_pipeline,
ref: merge_request.source_branch,
sha: merge_request.diff_head_sha,
project: context.project)
end
before do
pipeline.run!
......@@ -121,7 +123,6 @@ describe Gitlab::CycleAnalytics::Events do
end
end
def setup(context)
milestone = create(:milestone, project: project)
context.update(milestone: milestone)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment