の渡し:キュウリ/カピバラ機能は、常に私は、次のキュウリのシナリオを持っているに関係なく、ページコンテンツ
Background:
Given the following roles exist:
| id | name |
| 1 | janitor |
And the following users exist:
| username | password | email | role_ids |
| janitor | Cleaning31 | [email protected] | 1 |
And I am logged in as "janitor" with password "Cleaning31"
And the following articles exist:
| id | title | slug | content |
| 1 | Article One | article-one | Article one. |
Scenario: Seeing link for deleting an article
When I view the article list
Then I should see the "Delete" link for article 1
...そしてその最後のステップの定義:
Then /^I should (not)?see the "([^"]*)" link (?:in|under|for) article (\d+)$/ do |negation, content, article_id|
page.should have_selector("\#article_#{article_id}") do |article|
if negation
article.should_not have_css('a', text: content)
else
article.should have_css('a', text: content)
end
end
end
私は変更しても機能またはビューのいずれかで「削除する」という単語を「これは決して機能しません」に設定すると、その機能は常に通過します。ただしブラウザでは、「削除」リンクは、「管理者」ロールを持つユーザーの記事にのみ正しく表示されます。
キュウリの「私にそのページを見せて」と「回答を表示する」というのは、それらがすべきことを示唆する多数の記事にもかかわらず、定義されていないようです。 (My env.rb)
他の機能は期待どおり機能するようです。私がどこでこれに間違っているのか誰にでも気付くことができますか?
ありがとうございますが、違いはありません。それは内容にかかわらずまだ通過します。他のすべての機能は同じスタイルで書かれ、正しく動作しますが、確かに.should_notと.should自体がアサーションですか? –
私の答えに編集を加えました。 – socjopata
それは、ありがとう!私はカピバラとWebratスタイルを使用しようとしていたのだろうか? –