diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-08-31 21:13:40 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-09-03 23:49:11 +0900 |
commit | ce7c0ac3dbdc3f2f2f34b39bf5ef3755e79e9d42 (patch) | |
tree | 2f86ef281b73d2c1ba9f372f759a3bbfd6c9882c /spec | |
parent | f3d3cecf5a7691c5df48fc6b0f3d206cd57203db (diff) | |
download | gitlab-ce-ce7c0ac3dbdc3f2f2f34b39bf5ef3755e79e9d42.tar.gz |
Add validation for protected attributes
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/ci/builds.rb | 5 | ||||
-rw-r--r-- | spec/factories/ci/pipelines.rb | 9 | ||||
-rw-r--r-- | spec/models/ci/build_spec.rb | 6 |
3 files changed, 17 insertions, 3 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index f8922275860..bdc3e8acc07 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -12,6 +12,7 @@ FactoryGirl.define do started_at 'Di 29. Okt 09:51:28 CET 2013' finished_at 'Di 29. Okt 09:53:28 CET 2013' commands 'ls -a' + protected false options do { @@ -227,11 +228,11 @@ FactoryGirl.define do self.when 'manual' end - trait(:protected) do + trait :protected do protected true end - trait(:unprotected) do + trait :unprotected do protected false end end diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index e83a0e599a8..5b51f5898a3 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -4,6 +4,7 @@ FactoryGirl.define do ref 'master' sha '97de212e80737a608d939f648d959671fb0a0142' status 'pending' + protected false project @@ -59,6 +60,14 @@ FactoryGirl.define do trait :failed do status :failed end + + trait :protected do + protected true + end + + trait :unprotected do + protected false + end end end end diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index a94fdbf8434..cab59db3580 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -59,7 +59,11 @@ describe Ci::Build do end context 'when protected is false' do - let!(:job) { create(:ci_build, protected: nil) } + let!(:job) { create(:ci_build) } + + before do + job.update_attribute(:protected, nil) + end it { is_expected.not_to include(job) } end |