Replace stub! with stub

Remove warning 'DEPRECATION: stub! is deprecated. Use stub instead.'
Replace mock with double

This removes warnings 'DEPRECATION: mock is deprecated. Use double instead.'
Extract the shared examples for authentication

This removes the following examples

Accessing shared_examples defined across contexts is deprecated.
Please declare shared_examples within a shared context, or at the top level.
Fix The definition level mismatch of shared examples