summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-23 13:04:06 +0100
committerJames Lopez <james@jameslopez.es>2017-01-17 11:32:55 +0100
commite4e313fccab6816fb2e52ebdf83807fba4a52051 (patch)
tree14608c8b47cbc6e136e4a5d3ea160c26b284a892
parenta67311cb4c9f54af43d300fde5240f9a370193d1 (diff)
downloadgitlab-ce-e4e313fccab6816fb2e52ebdf83807fba4a52051.tar.gz
Fix other spec failures
-rw-r--r--spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb (renamed from spec/models/cycle_analytics/summary_spec.rb)16
-rw-r--r--spec/serializers/analytics_summary_serializer_spec.rb4
2 files changed, 10 insertions, 10 deletions
diff --git a/spec/models/cycle_analytics/summary_spec.rb b/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
index a8c1c4b9c5e..77dbf1c79a5 100644
--- a/spec/models/cycle_analytics/summary_spec.rb
+++ b/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
@@ -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
diff --git a/spec/serializers/analytics_summary_serializer_spec.rb b/spec/serializers/analytics_summary_serializer_spec.rb
index fe551734bc1..e08e3f88710 100644
--- a/spec/serializers/analytics_summary_serializer_spec.rb
+++ b/spec/serializers/analytics_summary_serializer_spec.rb
@@ -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