Rspec没有在应用程序上运行

时间:2012-02-09 13:52:29

标签: ruby-on-rails ruby-on-rails-3 unit-testing rspec tdd

好的,所以我是rails开发人员的红宝石,我即将开始尝试使用TDD(测试驱动开发)方法,我不确定我做错了什么。我有一个已经有一些rpec测试的现有应用程序,我正在尝试计算如何运行它们但是当我这样做时

rake spec
(in /Users/tamer/Sites/preview)
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library': uninitialized constant PreviewsController (NameError)
    from /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rspec-core-2.5.1/lib/rspec/core/backward_compatibility.rb:20:in `const_missing'
    from /Users/tamer/Sites/preview/spec/controllers/previews_controller_spec.rb:3:in `<top (required)>'
    from /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `block in load_spec_files'
    from /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `map'
    from /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
    from /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in `run'
    from /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
    from /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
    from /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `block in autorun'
rake aborted!

(See full trace by running task with --trace)

是否有一些我缺少的东西,以及我需要做些什么才能让以前的测试运行

1 个答案:

答案 0 :(得分:3)

错误非常明显。

uninitialized constant PreviewsController (NameError)

PreviewsController中不再存在./spec/controllers/previews_controller_spec.rb引用的/app/controllers类。

如果已移除相应的控制器,请更新规格或将其删除。