Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: intermittently failing tests #1608

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/factories/stash_engine/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
create(:description, resource_id: resource.id)
create(:right, resource: resource)
create(:contributor, resource: resource)
resource.subjects << create(:subject, subject_scheme: 'fos')
3.times { resource.subjects << create(:subject) }
resource.subjects << create(:subject, subject: Faker::Lorem.unique.word, subject_scheme: 'fos')
3.times { resource.subjects << create(:subject, subject: Faker::Lorem.unique.word) }
end

trait :submitted do
Expand Down
3 changes: 0 additions & 3 deletions spec/models/stash_engine/resources_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,6 @@ module StashEngine
end

it 'purges duplicate subjects' do
@resource.purge_duplicate_subjects!
@resource.subjects << create(:subject, subject: 'AARDVARKS')
@resource.subjects << create(:subject, subject: 'Aardvarks')
@resource.subjects << create(:subject, subject: 'aardvarks')
Expand All @@ -802,7 +801,6 @@ module StashEngine
end

it "doesn't purge FOS subjects" do
@resource.purge_duplicate_subjects!
existing_fos = @resource.subjects.fos.first
@resource.subjects << create(:subject, subject: existing_fos.subject) # this one doesn't have fos subject_scheme set
@resource.subjects << create(:subject, subject: existing_fos.subject)
Expand All @@ -815,7 +813,6 @@ module StashEngine
end

it 'prefers to purge non-controlled vocab subjects over ones with vocabulary' do
@resource.purge_duplicate_subjects!
existing_subj = @resource.subjects.non_fos.first
@resource.subjects << create(:subject, subject: existing_subj.subject, subject_scheme: 'gumma')
starting_size = @resource.subjects.count
Expand Down
Loading