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

我怎样才能让那些未决的有文字而不是“没有给出理由”

我已经尝试在单词pending 之后和块之前放置一些文本,但这没有帮助 - 它出现在行尾 - 但我仍然有所有“没有给出理由”。

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 回答