jaredbeck / minitest_to_rspec

Converts minitest files to rspec
MIT License
81 stars 12 forks source link

Support mocha stubs without returns #15

Closed jaredbeck closed 7 years ago

jaredbeck commented 7 years ago

This patch includes two changes to mocha stubs:

  1. Previously, mocha stubs like the following were not converted.
a.stubs(:x).once
a.stubs(:x).twice
A.any_instance.stubs(:x).once
A.any_instance.stubs(:x).twice

Now, they are converted as follows:

expect(a).to(receive(:x).once)
expect(a).to(receive(:x).twice)
expect_any_instance_of(A).to(receive(:x).once)
expect_any_instance_of(A).to(receive(:x).twice)
  1. Previously, mocha stubs with message counts (eg. once, twice) were converted to rspec allow. Going forward, they will be converted to rspec expect.