5

私はこのコードを持っています:

context "Visiting the users #index page." do
  before(:each) { visit users_path }
  subject { page }
  pending('iii') { should have_no_css('table#users') }      
  pending { should have content('You have reached this page due to a permiss

イオンエラー')}

その結果、いくつかの保留が発生します。

Managing Users Given a practitioner logged in. Visiting the users #index page.
# No reason given
# ./spec/requests/role_users_spec.rb:78
Managing Users Given a practitioner logged in. Visiting the users #index page. 
# No reason given
# ./spec/requests/role_users_spec.rb:79

これらの保留中のテキストを「理由なし」ではなくテキストにする方法を教えてください。

保留中の単語の後、ブロックの前にテキストを入れようとしましたが、それは役に立ちませんでした-それは行の最後に表示されました-しかし、私はまだすべての「理由が与えられていません」を持っています。

4

1 に答える 1

10

pendingそれ自体がメソッドであり、通常のユースケースは次のようなものです。

  it "should say yo" do
    pending "that's right, yo"
    subject.yo!.should eq("yo!")
  end 

それは出力されます

Pending:
  Yo should say yo
    # that's right, yo
    # ./yo.rb:8

だから、あなたが短い形式を使いたいとき、

its(:yo!) {should eq("yo!") }

次に、保留中としてマークするには、いくつかのオプションがあります。

xits(:you!) {should eq("yo!") }
pending(:you!) {should eq("yo!")}

ただし、メッセージで保留を取得するには、次のことを行う必要があります。

its(:yo!) {pending "waiting on client"; should eq("yo!") }

それはあなたに出力を与えるでしょう

  Yo yo! 
    # waiting for client
    # ./yo.rb:16
于 2012-07-23T14:22:30.107 に答える