Like the title says, if you pass an Action into the ContextFactory that is outside the Action set of an Organizer the entire Organizer is executed with no errors raised or indication that this happened. Given the nature of development, the scenario where a user (developer) renames an Action is highly likely and dependant specs will still pass but execute the whole context with no indication to the user.
This is misleading to the developer, who expects the Organizer to execute up-to a specific action and not more. If provided an unreferenced action in the supplied Organizer, the ContextFactory should raise an error about it.
Failing spec:
context 'when called with an invalid action' do
let(:organizer) { TestDoubles::AdditionOrganizer }
let(:invalid_action) { TestDoubles::MakesLatteAction }
it 'raises an argument error' do
expect do
LightService::Testing::ContextFactory
.make_from(organizer)
.for(invalid_action)
.with(1)
end.to raise_error(
ArgumentError,
"Could not find #{invalid_action} in #{organizer}"
)
end
end
Like the title says, if you pass an Action into the ContextFactory that is outside the Action set of an Organizer the entire Organizer is executed with no errors raised or indication that this happened. Given the nature of development, the scenario where a user (developer) renames an Action is highly likely and dependant specs will still pass but execute the whole context with no indication to the user.
This is misleading to the developer, who expects the Organizer to execute up-to a specific action and not more. If provided an unreferenced action in the supplied Organizer, the ContextFactory should raise an error about it.
Failing spec:
Proposed Solution: https://github.com/adomokos/light-service/pull/141#discussion_r178331102