Skip to content

Commit

Permalink
inline collections_controller_resource_spec to existing tests
Browse files Browse the repository at this point in the history
`dashboard/collections_controller_resource_spec` is a slightly divergent
copy-paste of the same tests in `dashboard/collections_controller_spec`. this
creates a major maintenance burden, and some weird misdirection when navigating
the codebase (how will i know to look for tests on the Controller here?).

the more immediate problem is that this whole test setup is flaky and the whole
file can fail en masse.

as a first step(?) for a fix, we want to inline all the tests so they run
identically and setup for both sets of specs is in one place. this is a straight
inline, removing the duplicate tests. some attention was given to resolving
drift between the specs.
  • Loading branch information
tamsin johnson committed Aug 8, 2023
1 parent 08ef6c9 commit 2bcd500
Show file tree
Hide file tree
Showing 4 changed files with 691 additions and 1,313 deletions.
5 changes: 4 additions & 1 deletion app/models/hyrax/collection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ def title=(value)
# @return [Hyrax::PcdmCollection | ::Collection] an instance of Hyrax::CollectionType with id = the model_id portion of the gid (e.g. 3)
# @raise [ActiveRecord::RecordNotFound] if record matching gid is not found
def self.for(collection:)
find_by_gid!(collection.collection_type_gid)
gid = collection.collection_type_gid
gid = gid.first if gid.is_a?(Enumerable)

find_by_gid!(gid)
end

# Find the collection type associated with the Global Identifier (gid)
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/hyrax/collections_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,6 @@
end
end
end

context "using a Valkyrie CollectionResource model"
end
Loading

0 comments on commit 2bcd500

Please sign in to comment.