Rspec stub before filter method

Viewed 1445

I have such method in my application controller

before_filter :client_signed_in?

def client_signed_in?
    if cookies.signed[:client_id]
        @current_client = Client.find_by_id cookies.signed[:client_id]
        @client_signed_in = true unless @current_client.nil?
    end
end

i have tried to stub it

allow(ApplicationController).to receive(:client_signed_in?).and_return(true)

also

allow(ApplicationController).to receive(:@client_signed_in).and_return(true)

but in both cases it have returned nil

how to fix it?

2 Answers
Related