Fix other spec failures
This commit is contained in:
parent
a67311cb4c
commit
e4e313fcca
2 changed files with 10 additions and 10 deletions
|
@ -4,20 +4,20 @@ describe Gitlab::CycleAnalytics::StageSummary, models: true do
|
|||
let(:project) { create(:project) }
|
||||
let(:from) { Time.now }
|
||||
let(:user) { create(:user, :admin) }
|
||||
subject { CycleAnalyticsTest.new(project, options: { from: from_date }) }
|
||||
subject { described_class.new(project, from: Time.now).data }
|
||||
|
||||
describe "#new_issues" do
|
||||
it "finds the number of issues created after the 'from date'" do
|
||||
Timecop.freeze(5.days.ago) { create(:issue, project: project) }
|
||||
Timecop.freeze(5.days.from_now) { create(:issue, project: project) }
|
||||
|
||||
expect(subject.new_issues).to eq(1)
|
||||
expect(subject.first[:value]).to eq(1)
|
||||
end
|
||||
|
||||
it "doesn't find issues from other projects" do
|
||||
Timecop.freeze(5.days.from_now) { create(:issue, project: create(:project)) }
|
||||
|
||||
expect(subject.new_issues).to eq(0)
|
||||
expect(subject.first[:value]).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,19 +26,19 @@ describe Gitlab::CycleAnalytics::StageSummary, models: true do
|
|||
Timecop.freeze(5.days.ago) { create_commit("Test message", project, user, 'master') }
|
||||
Timecop.freeze(5.days.from_now) { create_commit("Test message", project, user, 'master') }
|
||||
|
||||
expect(subject.commits).to eq(1)
|
||||
expect(subject.second[:value]).to eq(1)
|
||||
end
|
||||
|
||||
it "doesn't find commits from other projects" do
|
||||
Timecop.freeze(5.days.from_now) { create_commit("Test message", create(:project), user, 'master') }
|
||||
|
||||
expect(subject.commits).to eq(0)
|
||||
expect(subject.second[:value]).to eq(0)
|
||||
end
|
||||
|
||||
it "finds a large (> 100) snumber of commits if present" do
|
||||
Timecop.freeze(5.days.from_now) { create_commit("Test message", project, user, 'master', count: 100) }
|
||||
|
||||
expect(subject.commits).to eq(100)
|
||||
expect(subject.second[:value]).to eq(100)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -47,13 +47,13 @@ describe Gitlab::CycleAnalytics::StageSummary, models: true do
|
|||
Timecop.freeze(5.days.ago) { create(:deployment, project: project) }
|
||||
Timecop.freeze(5.days.from_now) { create(:deployment, project: project) }
|
||||
|
||||
expect(subject.deploys).to eq(1)
|
||||
expect(subject.third[:value]).to eq(1)
|
||||
end
|
||||
|
||||
it "doesn't find commits from other projects" do
|
||||
Timecop.freeze(5.days.from_now) { create(:deployment, project: create(:project)) }
|
||||
|
||||
expect(subject.deploys).to eq(0)
|
||||
expect(subject.third[:value]).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -8,10 +8,10 @@ describe AnalyticsSummarySerializer do
|
|||
|
||||
let(:json) { serializer.as_json }
|
||||
let(:project) { create(:empty_project) }
|
||||
let(:resource) { Gitlab::CycleAnalytics::StageSummary::Issue.new(project: double, from: 1.day.ago) }
|
||||
let(:resource) { Gitlab::CycleAnalytics::Summary::Issue.new(project: double, from: 1.day.ago) }
|
||||
|
||||
before do
|
||||
allow_any_instance_of(Gitlab::CycleAnalytics::StageSummary::Issue).to receive(:value).and_return(1.12)
|
||||
allow_any_instance_of(Gitlab::CycleAnalytics::Summary::Issue).to receive(:value).and_return(1.12)
|
||||
end
|
||||
|
||||
it 'it generates payload for single object' do
|
||||
|
|
Loading…
Reference in a new issue