Skip to content

Stub controller helper method on rspec rails 3 #1076

@bolshakov

Description

@bolshakov

Before Rspec 3 I've stubbed controller helper method this way:

before do 
   expect(view).to receive(:current_customer).and_return(FactoryGirl.build(:customer)
end

Now, i'm getting error: #<#<Class:0x007fc72addeea8>:0x007fc72add56f0 .... >does not implement: current_customer

Thats right. There is no method current_customer on rendered view. So I can't stub it.

There is no such method on anonymous controller too.

So how should I stub controller helpers while testing view?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions