Skip to content

Instantly share code, notes, and snippets.

@stefanahman
Last active November 17, 2017 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanahman/ae52c7f6d5fc7f1241d8e02b058a6aee to your computer and use it in GitHub Desktop.
Save stefanahman/ae52c7f6d5fc7f1241d8e02b058a6aee to your computer and use it in GitHub Desktop.
Sublime: Rspec 2 to Rspec 3

stub => expect

Search:

^(\s*)(.*?).stub\((.*?)\)\.

Replace:

$1expect($2).to receive($3).

any_instance.should_receive => expect_any_instance_of

Search:

^(\s*)(.*?)\.any_instance\.should_receive(.*)

Replace:

$1expect_any_instance_of($2).to receive$3

any_instance.stub => allow_any_instance_of

Search:

^(\s*)(.*?)\.any_instance\.stub(.*)

Replace:

$1allow_any_instance_of($2).to receive_messages$3

any_instance.should_not_receive => expect_any_instance_of (not)

Search:

^(\s*)(.*?)\.any_instance\.should_not_receive(.*)

Replace:

$1expect_any_instance_of($2).not_to receive$3

should_not_receive => expect (not)

Search:

^(\s*)(.*?)\.should_not_receive(.*)

Replace:

$1expect($2).not_to receive$3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment