-
{:x => y}
->{x: y}
Find Replace Comment :(\w+) =>
\1:
-
foo.should
->expect(foo).to
Find Replace Comment ^(\s*)(.*)\.should_
\1expect(\2).to
to not_
to_not
# handle should not_ case
-
foo.stub(:bar)
->allow(foo).to receive(:bar)
Find Replace Comment before \{\s(.*)\.stub\((.*)\)
before { allow(\1).to receive(\2)
# do before blocks first
^(^(?!.*(\#|before)))(\s*)(.*)\.stub\((.*)\)
\3allow(\4).to receive(\5)
# if before block or comment, skip
-
foo.stub_chain(:bar, :baz)
->allow(foo).to receive_message_chain(:bar, :baz)
Find Replace Comment before\s\{\s(.*)\.stub_chain\((.*)\)
before { allow(\1).to receive_message_chain(\2)
# do before blocks first
^(^(?!.*(\#|before)))(\s*)(.*)\.stub_chain\((.*)\)
\3allow(\4).to receive_message_chain(\5)
# skip if comment