Commit b1222ebc authored by Robert Speicher's avatar Robert Speicher

Use `:empty_project` where possible in serializer specs

parent 90e802cd
...@@ -8,7 +8,7 @@ describe AnalyticsIssueSerializer do ...@@ -8,7 +8,7 @@ describe AnalyticsIssueSerializer do
end end
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:resource) do let(:resource) do
{ {
total_time: "172802.724419", total_time: "172802.724419",
......
...@@ -8,7 +8,7 @@ describe AnalyticsMergeRequestSerializer do ...@@ -8,7 +8,7 @@ describe AnalyticsMergeRequestSerializer do
end end
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:resource) do let(:resource) do
{ {
total_time: "172802.724419", total_time: "172802.724419",
......
...@@ -6,7 +6,7 @@ describe CommitEntity do ...@@ -6,7 +6,7 @@ describe CommitEntity do
end end
let(:request) { double('request') } let(:request) { double('request') }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:commit) { project.commit } let(:commit) { project.commit }
subject { entity.as_json } subject { entity.as_json }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe EnvironmentSerializer do describe EnvironmentSerializer do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:json) do let(:json) do
described_class described_class
...@@ -11,21 +11,20 @@ describe EnvironmentSerializer do ...@@ -11,21 +11,20 @@ describe EnvironmentSerializer do
end end
context 'when there is a single object provided' do context 'when there is a single object provided' do
before do let(:project) { create(:project, :repository) }
create(:ci_build, :manual, name: 'manual1', let(:deployable) { create(:ci_build) }
pipeline: deployable.pipeline)
end
let(:deployment) do let(:deployment) do
create(:deployment, deployable: deployable, create(:deployment, deployable: deployable,
user: user, user: user,
project: project, project: project,
sha: project.commit.id) sha: project.commit.id)
end end
let(:deployable) { create(:ci_build) }
let(:resource) { deployment.environment } let(:resource) { deployment.environment }
before do
create(:ci_build, :manual, name: 'manual1', pipeline: deployable.pipeline)
end
it 'contains important elements of environment' do it 'contains important elements of environment' do
expect(json) expect(json)
.to include(:name, :external_url, :environment_path, :last_deployment) .to include(:name, :external_url, :environment_path, :last_deployment)
......
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