This commit is contained in:
2026-08-25 14:49:23 +02:00
parent c802605525
commit 552fdbe3a4
40 changed files with 207 additions and 182 deletions
+2 -2
View File
@@ -109,8 +109,8 @@ RSpec.describe WarpEngine::ApplicationToken, type: :model do
token = create(:application_token)
token.revoke!
expect(described_class.find_by(id: token.id)).to be_nil
expect(described_class.unscoped.find(token.id).deleted_at).to be_present
expect(described_class.kept.find_by(id: token.id)).to be_nil
expect(described_class.find(token.id).deleted_at).to be_present
end
end
+10 -4
View File
@@ -36,18 +36,24 @@ RSpec.describe WarpEngine::Pipeline do
end
end
describe "default_scope" do
describe ".kept scope" do
it "excludes soft-deleted records" do
repo = create(:pipeline)
repo.update_column(:deleted_at, Time.current)
expect(described_class.all).not_to include(repo)
expect(described_class.unscoped).to include(repo)
expect(described_class.kept).not_to include(repo)
end
it "includes soft-deleted records without scope" do
repo = create(:pipeline)
repo.update_column(:deleted_at, Time.current)
expect(described_class.all).to include(repo)
end
end
describe ".active" do
it "returns only active repos" do
it "returns only active kept repos" do
active = create(:pipeline, active: true)
inactive = create(:pipeline, active: false)
+9 -2
View File
@@ -13,12 +13,19 @@ RSpec.describe WarpEngine::Software, type: :model do
it { should have_many(:external_links) }
it { should have_many(:software_images).dependent(:destroy) }
describe "default scope" do
describe ".kept scope" do
it "excludes soft-deleted records" do
active = create(:software)
create(:software, deleted_at: Time.current)
expect(WarpEngine::Software.all).to eq([active])
expect(WarpEngine::Software.kept).to eq([active])
end
it "includes soft-deleted records without scope" do
active = create(:software)
deleted = create(:software, deleted_at: Time.current)
expect(WarpEngine::Software.all).to contain_exactly(active, deleted)
end
end
end