0

私は次のような仕様を持っています。手動でテストを行うと問題なく動作しますが、仕様を実行すると、以下のエラーが発生します。

    before(:each) do 
      @user_having_unread_message = FactoryGirl.create(:user_having_unread_message)
      login_as(@user_having_unread_message, scope: :user)
      visit conversations_path
      within("section.items-group") do
        first(:link, "Test message").click
      end
    end

    it "list all messages", touch: true do 
      within(".messages-group") do
        page.should have_content "Test message"
      end
    end

これは私が得るエラーです

  1) Messages GET /:username/messages when signed in and active list all messages
     Failure/Error: within(".messages-group") do
     Capybara::ElementNotFound:
       Unable to find css ".messages-group"
     # ./spec/features/messages_spec.rb:84:in `block (5 levels) in <top (required)>'

「テストメッセージ」リンクを手動でクリックすると、次のページに表示されるので、なぜElementNotFoundfor を取得しているのかわかりません。.messages-group

何か案が?

4

1 に答える 1

0

page.should have_css('.messages-group', :text => 'Textmessage')

それはあなたを助けるでしょう。

于 2013-02-11T13:01:00.383 に答える