summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/build_spec.rb2
-rw-r--r--spec/models/ci/processable_spec.rb2
-rw-r--r--spec/models/protected_branch_spec.rb8
-rw-r--r--spec/models/repository_spec.rb3
4 files changed, 11 insertions, 4 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index dea1c5c57e1..d45660d120d 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -2598,7 +2598,7 @@ RSpec.describe Ci::Build do
context 'when token is empty' do
before do
- build.update_columns(token: nil, token_encrypted: nil)
+ build.update_columns(token_encrypted: nil)
end
it { is_expected.to be_nil}
diff --git a/spec/models/ci/processable_spec.rb b/spec/models/ci/processable_spec.rb
index cdd96d45561..743736236c2 100644
--- a/spec/models/ci/processable_spec.rb
+++ b/spec/models/ci/processable_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe Ci::Processable do
let(:clone_accessors) { ::Ci::Build.clone_accessors.without(::Ci::Build.extra_accessors) }
let(:reject_accessors) do
- %i[id status user token token_encrypted coverage trace runner
+ %i[id status user token_encrypted coverage trace runner
artifacts_expire_at
created_at updated_at started_at finished_at queued_at erased_by
erased_at auto_canceled_by job_artifacts job_artifacts_archive
diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb
index 366de809bed..a3fc09b31fb 100644
--- a/spec/models/protected_branch_spec.rb
+++ b/spec/models/protected_branch_spec.rb
@@ -190,6 +190,14 @@ RSpec.describe ProtectedBranch do
expect(described_class).not_to receive(:matching)
expect(described_class.protected?(project, protected_branch.name)).to eq(true)
end
+
+ it 'sets expires_in for a cache key' do
+ cache_key = described_class.protected_ref_cache_key(project, protected_branch.name)
+
+ expect(Rails.cache).to receive(:fetch).with(cache_key, expires_in: 1.hour)
+
+ described_class.protected?(project, protected_branch.name)
+ end
end
end
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index b5db4492ab9..05ba79e2b98 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -2773,8 +2773,7 @@ RSpec.describe Repository do
end
def create_remote_branch(remote_name, branch_name, target)
- rugged = rugged_repo(repository)
- rugged.references.create("refs/remotes/#{remote_name}/#{branch_name}", target.id)
+ repository.write_ref("refs/remotes/#{remote_name}/#{branch_name}", target.id)
end
shared_examples '#ancestor?' do