Extract RSpec 'let'
The Extract RSpec 'let' refactoring allows you to extract a specified code fragment into a memoized helper method. To do this, perform the following steps:
In a spec file, select a required code fragment and selectCommand Shift L from the main menu.
Specify the desired name of a helper method and press Enter.
If more than one occurrence of the code fragment is found, RubyMine will suggest replacing these occurrences with a helper method call.
Click Yes to replace the found occurrences. If you want to replace the selected occurrence only, click No.