jdliss / shoulda-callback-matchers

Test existence of your Rails callbacks without having to call them
MIT License
134 stars 18 forks source link

Does not work with after_commit on create #18

Closed asia653 closed 8 years ago

asia653 commented 8 years ago

I can provide a test case

class User < ActiveRecord::Base

after_commit :upload_image, on: [:update,:create]

end

it { is_expected.to callback(:upload_image).after(:commit).on(:update) }

Fails^

asia653 commented 8 years ago

Additional information - it appears that the new syntax does not work

Looking at your tests, it requires the old format of after_commit :method, :on => :action

beatrichartz commented 8 years ago

Interesting, thanks for raising this - I think this could be quite simply adapted to, by adding something like:

it { is_expected.to callback(:upload_image).after(:commit).on(:create, :update) }

to the matchers. I'll bring this in as soon as I find the time.