Skip to content
Snippets Groups Projects
Commit d8478d16 authored by Shinya Maeda's avatar Shinya Maeda
Browse files

Fix spec

parent 5547baa3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,6 +3,7 @@ module Ci
include TokenAuthenticatable
include AfterCommitQueue
include Presentable
include Importable
 
belongs_to :runner
belongs_to :trigger_request
Loading
Loading
@@ -26,7 +27,7 @@ module Ci
 
validates :coverage, numericality: true, allow_blank: true
validates :ref, presence: true
validates :protected, inclusion: { in: [true, false] }, on: :create
validates :protected, inclusion: { in: [true, false], unless: :importing? }, on: :create
 
scope :unstarted, ->() { where(runner_id: nil) }
scope :ignore_failures, ->() { where(allow_failure: false) }
Loading
Loading
Loading
Loading
@@ -37,7 +37,8 @@ class Spinach::Features::ProjectPages < Spinach::FeatureSteps
step 'pages are deployed' do
pipeline = @project.pipelines.create(ref: 'HEAD',
sha: @project.commit('HEAD').sha,
source: :push)
source: :push,
protected: false)
 
build = build(:ci_build,
project: @project,
Loading
Loading
Loading
Loading
@@ -74,7 +74,8 @@ module API
source: :external,
sha: commit.sha,
ref: ref,
user: current_user)
user: current_user,
protected: @project.protected_for?(ref))
end
 
status = GenericCommitStatus.running_or_pending.find_or_initialize_by(
Loading
Loading
@@ -82,7 +83,8 @@ module API
pipeline: pipeline,
name: name,
ref: ref,
user: current_user
user: current_user,
protected: @project.protected_for?(ref)
)
 
optional_attributes =
Loading
Loading
Loading
Loading
@@ -16,8 +16,8 @@ describe API::CommitStatuses do
let(:get_url) { "/projects/#{project.id}/repository/commits/#{sha}/statuses" }
 
context 'ci commit exists' do
let!(:master) { project.pipelines.create(source: :push, sha: commit.id, ref: 'master') }
let!(:develop) { project.pipelines.create(source: :push, sha: commit.id, ref: 'develop') }
let!(:master) { project.pipelines.create(source: :push, sha: commit.id, ref: 'master', protected: false) }
let!(:develop) { project.pipelines.create(source: :push, sha: commit.id, ref: 'develop', protected: false) }
 
context "reporter user" do
let(:statuses_id) { json_response.map { |status| status['id'] } }
Loading
Loading
Loading
Loading
@@ -565,7 +565,7 @@ describe API::Commits do
end
 
context 'when the ref has a pipeline' do
let!(:pipeline) { project.pipelines.create(source: :push, ref: 'master', sha: commit.sha) }
let!(:pipeline) { project.pipelines.create(source: :push, ref: 'master', sha: commit.sha, protected: false) }
 
it 'includes a "created" status' do
get api(route, current_user)
Loading
Loading
Loading
Loading
@@ -386,7 +386,7 @@ describe API::V3::Commits do
end
 
it "returns status for CI" do
pipeline = project.pipelines.create(source: :push, ref: 'master', sha: project.repository.commit.sha)
pipeline = project.pipelines.create(source: :push, ref: 'master', sha: project.repository.commit.sha, protected: false)
pipeline.update(status: 'success')
 
get v3_api("/projects/#{project.id}/repository/commits/#{project.repository.commit.id}", user)
Loading
Loading
@@ -396,7 +396,7 @@ describe API::V3::Commits do
end
 
it "returns status for CI when pipeline is created" do
project.pipelines.create(source: :push, ref: 'master', sha: project.repository.commit.sha)
project.pipelines.create(source: :push, ref: 'master', sha: project.repository.commit.sha, protected: false)
 
get v3_api("/projects/#{project.id}/repository/commits/#{project.repository.commit.id}", user)
 
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@ describe Ci::RetryBuildService do
%i[type lock_version target_url base_tags
commit_id deployments erased_by_id last_deployment project_id
runner_id tag_taggings taggings tags trigger_request_id
user_id auto_canceled_by_id retried protected].freeze
user_id auto_canceled_by_id retried].freeze
 
shared_examples 'build duplication' do
let(:stage) do
Loading
Loading
@@ -48,7 +48,7 @@ describe Ci::RetryBuildService do
describe 'clone accessors' do
CLONE_ACCESSORS.each do |attribute|
it "clones #{attribute} build attribute" do
expect(new_build.send(attribute)).to be_present
expect(new_build.send(attribute)).not_to be_nil
expect(new_build.send(attribute)).to eq build.send(attribute)
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment