0

嘿,这就是我所在的地方:

$ spec spec/

Finished in 0.002031 seconds

0 examples, 0 failures

然而。我已经完成了我编写的前几个测试并将它们放在 /spec/controllers/citations_controller_spec.rb

并在上面的规范中添加了一个 puts 来验证它实际上是在使用:

spec spec/

这是 citations_controller_spec.rb 的内容(它有现有的测试):

require 'spec_helper'

describe CitationsController do
  describe "GET 'home'" do
    it "should be successful" do
      get 'home'
      response.should be_success
    end
    it "should have the right title" do
      get 'home'
      response.should have_tag("title",
                               "Ruby on Rails Tutorial Sample App | Home")
    end
  end

  describe "GET 'contact'" do
    it "should be successful" do
      get 'contact'
      response.should be_success
    end
    it "should have the right title" do
      get 'contact'
      response.should have_tag("title",
                               "Ruby on Rails Tutorial Sample App | Contact")
    end
  end

  describe "GET 'about'" do
    it "should be successful" do
      get 'about'
      response.should be_success
    end
    it "should have the right title" do
      get 'about'
      response.should have_tag("title",
                               "Ruby on Rails Tutorial Sample App | About")
    end
  end
end

但如第一个代码位所示......

0 examples, 0 failures

..所以有人碰巧知道这里发生了什么吗?

4

1 回答 1

1

尝试

spec spec/controllers/citations_controller_spec.rb

运行一个测试文件。或者

rake test

运行所有测试。您现在看到任何测试点或示例吗?

于 2012-10-22T04:13:39.690 回答