search for: post_controller_spec

Displaying 1 result from an estimated 1 matches for "post_controller_spec".

Did you mean: posts_controller_spec
2011 Dec 02
2
problem setting expectation for test with delayed::job
...got something like this: # post_observer.rb after_create # ...stuff Delayed::Job.enqueue(PostSharer.new(post, post.user)) end ... # post_sharer.rb class PostSharer < Struct.new(:post, user) def perform # Delayed::Job calls .perform on the object passed into enqueue end end # post_controller_spec.rb it "shares the post" do PostSharer.expects(:new).once lambda { do_post }.should change(Delayed::Job, :count).by(1) end ... This fails due to the expectation put on PostSharer receiving .new --- if I remove that, then it all works fine... And if I look at the test database, De...