Hyrax is a Ruby on Rails Engine built by the Samvera community. Hyrax provides a foundation for creating many different digital repository applications.
Several stubs in this file are on a method name that doesn't exist.
allow(collection.collection_type).to receive(:share_applies_to_works).and_return(true) should stub :share_applies_to_new_works? instead. Additionally, because the tested actor uses ActiveFedora::Base#find to retrieve a new instance of the example collection, the stubs are not used by the code under test even when they do stub the correct method.
At a glance, these stubs seem integral to test setup. Since the tests in question pass, this points to other potential issues with tests or their setup; i.e. it doesn't seem these tests exercise the behavior they are meant to.
Descriptive summary
Several stubs in this file are on a method name that doesn't exist.
allow(collection.collection_type).to receive(:share_applies_to_works).and_return(true)
should stub:share_applies_to_new_works?
instead. Additionally, because the tested actor usesActiveFedora::Base#find
to retrieve a new instance of the example collection, the stubs are not used by the code under test even when they do stub the correct method.Compare:
At a glance, these stubs seem integral to test setup. Since the tests in question pass, this points to other potential issues with tests or their setup; i.e. it doesn't seem these tests exercise the behavior they are meant to.
The tests should use factory setup instead of stubbing the methods. See https://github.com/samvera/hyrax/pull/2612/files#diff-05ea185029fb2aa40e1887104f3031f3R288 for an example.
Related work
2612