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

1 つのテスト ファイルを実行します。または

rake test

すべてのテストを実行します。テストドットや例はありますか?

于 2012-10-22T04:13:39.690 に答える