尽管我添加了link_to"登录"?为什么我仍然会继续收到此错误

时间:2016-12-26 23:45:07

标签: ruby-on-rails ruby devise

为我的Ruby on Rails项目做一些BDD并且Guard继续给我这个消息:

Users sign-in with valid credentials Failure/Error: click_link "Sign in" Capybara::ElementNotFound: Unable to find link "Sign in"

尽管我已添加"登录",请查看此处的代码:

这是我的app / views / devise / layouts / application.html.erb的部分代码:

<nav class="navbar navbar-default navbar-fixed-top"     role="navigation">
        <div class="container-fluid">
                <div class="navbar-header">
                <button type="button"     class="navbar-toggle" data-toggle="collapse" data-    target="#bs-example-navbar-collapse-1">
                    <span class="icon-bar">    </span>
                    <span class="icon-bar">    </span>
                    <span class="icon-bar">    </span>
                </button>
                <%= link_to "Blog App",     root_path, class: "navbar-brand" %>
            </div>
            <div class="navbar-collapsecollapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li class="active"><%= link_to "Authors", "#" %></li>
                    <% if user_signed_in? %>
                        <div class="navbar-right">
                            <p class="navbar-text">Signed in as <%= "#{current_user.email}" %></p>
                        </div>
                    <% end %>
                    <li><%= link_to "Sign Up", new_user_registration_path %></li>
                    <li><%= link_to "Sign In", new_user_session_path %></li>
                </ul>
            </div>
        </div>
    </nav>

1 个答案:

答案 0 :(得分:0)

Capybara正在寻找&#34;登录&#34; (click_link&#34;登录&#34;)并且在您的代码中,您有&#34;登录&#34;。