Rspec test of the object method call in controller
<p>I want to test that a controller create and update actions call a process method on the MentionService instance.</p>

<p>In controller I have MentionService.new(post).process</p>

<p>This is my current spec:</p>

<pre><code>it "calls MentionService if a post has been submitted" do
  post = Post.new(new_post_params)
  mention_service = MentionService.new(post)
  expect(mention_service).to receive(:process)
  xhr(:post, :create, company_id: company.id, remark: new_post_params)
end
</code></pre>

<p>In the controller actions I have:</p>

<pre><code>def create
  ...
  # after save
  MentionService.new(@remark).process
  ...
end
</code></pre>

<p>What I get is:</p>

<pre><code>expected: 1 time with any arguments
received: 0 times with any arguments
</code></pre>

<p>Any ideas?
Thanks.</p>