开发者

How do i test a module that extends my controllers?

开发者 https://www.devze.com 2023-03-03 12:24 出处:网络
I wanted to create a module because i needed to execute some methods upon every controller action of my application. Thus, i created a module and used a before_filter to my application开发者_StackOver

I wanted to create a module because i needed to execute some methods upon every controller action of my application. Thus, i created a module and used a before_filter to my application开发者_StackOverflow中文版 controller, so that it runs for every action.

This module is like a controller extension, since it handles redirects and has some methods as well. I need to have a logged in user to check that, but for some reason, the macro that i have for my other controllers is not recognized :

require 'spec_helper'
require 'devise/test_helpers'

describe GameEngine::GameLoop do
    login_user

    it "should check tavern quest" do
        ...
    end

end

I get that login_user is undefined, though it works for all my controller, where i need it. Why isn't it recognized on the module ?

0

精彩评论

暂无评论...
验证码 换一张
取 消