unit-testing - 使用 Authlogic on Rails 3 进行单元测试

标签 unit-testing authlogic ruby-on-rails-3

我想使用 Authlogic 为登录用户编写一些单元测试。为了正确开始,我使用了一些托管在 http://github.com/binarylogic/authlogic_example 中的代码。 .但是在 rake 测试 之后我得到一个错误,因为“test_helper.rb”和下面的类:

class ActionController::TestCase
  setup :activate_authlogic
end

这是我的错误:

NameError: undefined local variable or method `activate_authlogic' for

我认为这个 Authlogic 示例是映射到 Rails 2 上的;也许它在 Rails 3 上有点不同。是否有其他示例可以作为单元测试的示例?

非常感谢。

最佳答案

您是否需要'authlogic/test_case'include Authlogic::TestCase? 我有一个类似的问题(虽然使用 rspec)并通读了 http://github.com/trevmex/authlogic_rails3_example 处的代码

关于unit-testing - 使用 Authlogic on Rails 3 进行单元测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2999283/

相关文章:

ruby-on-rails - 带有 Authlogic 和调用 reset_session 的 Rails 3

ios - authlogic 和 iOS,我应该保存密码还是 token ,如何保存?

ruby-on-rails-3 - 嵌套 form_for 的 Rails 路由错误

ruby-on-rails - Rails 迁移 - self.up 和 self.down 有什么意义

visual-studio - Visual Studio 中未启用与测试用例的关联

javascript - 如何使用 John Papa 风格、Karma 和 Jasmine 数据服务测试 Angular 应用程序?

C 嵌入式自动单元测试生成

asp.net-mvc - ASP.NET MVC 自定义路由约束和依赖注入(inject)

devise - 什么是设计可以做而 Authlogic 不能做的?

ruby-on-rails-3 - 如何通过ActiveRecord告诉DataTable如何处理关联的数据表?