tkymtk
tkymtk

Reputation: 2705

How can I test rails controller actions call proper methods with RSpec?

Given this,

class SomeController < AbstractDocumentsController
  def create
    foo_method(params)
    bar_method
  end
end

How can I test foo_method and bar_method is called when create action is invoked?

Upvotes: 0

Views: 60

Answers (1)

afilipko
afilipko

Reputation: 81

I think you should use mocks for this. Example with rspec-mocks Github docs

For you code sample you can use something like this, I think expect_any_instance_of(SomeController).to receive(:foo_method)

Upvotes: 1

Related Questions