Note that there are some explanatory texts on larger screens.

plurals
  1. PORails have_selector not working when selector is in application.html.erb
    primarykey
    data
    text
    <p>When I hard code the following in new.html.erb just above the form_tag my test passes:</p> <pre><code>&lt;div class="alert alert-error"&gt;Invalid email/password combination&lt;/div&gt; </code></pre> <p>But when the div is generated using a flash.now message in application.html.erb, which yields to new.html.erb, the test fails.</p> <p>--------------- application.html.erb ---------------------</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;%= full_title(yield(:title)) %&gt;&lt;/title&gt; &lt;%= render 'layouts/stylesheets' %&gt; &lt;/head&gt; &lt;body&gt; &lt;a name="top" /&gt; &lt;div id="main_wrapper"&gt; &lt;%= render 'layouts/leaderboard_advertisement' %&gt; &lt;%= render 'layouts/header' %&gt; &lt;div id="threecolwrap"&gt; &lt;div id="twocolwrap"&gt; &lt;%= render 'layouts/left_advertisement' %&gt; &lt;section id="main_content_area"&gt; &lt;% flash.each do | key, value | %&gt; &lt;%= content_tag(:div, value, class: "alert alert-#{key}") %&gt; &lt;% end %&gt; &lt;%= yield %&gt; &lt;/section&gt; &lt;/div&gt; &lt;!-- end of twocolwrap --&gt; &lt;%= render 'layouts/left_advertisement' %&gt; &lt;/div&gt; &lt;!-- end of threcolwrap --&gt; &lt;%= render 'layouts/footer' %&gt; &lt;/div&gt; &lt;!-- end of main_wrapper --&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>--------------- new.html.erb ---------------------</p> <pre><code>&lt;% provide(:title, "Sign In") %&gt; &lt;div&gt; &lt;div class="pages_title1"&gt; &lt;h2 class='title_text_with_logo'&gt;Sign In&lt;/h2&gt; &lt;%= image_tag "logo1_140_22.png", class: 'title_logo title_logo_position_right' %&gt; &lt;/div&gt; &lt;div class="pages_text1 wide_column"&gt; &lt;div&gt; &lt;%= form_tag(sessions_path) do %&gt; &lt;%= label :session, :email %&gt; &lt;%= text_field :session, :email %&gt; &lt;%= label :session, :password %&gt; &lt;%= password_field :session, :password %&gt; &lt;%= submit_tag "Sign in" %&gt; &lt;% end %&gt; &lt;p&gt;New user? &lt;%= link_to "Sign up now!", signup_path %&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class='full_logo_center'&gt; &lt;%= image_tag "fulllogo1_200_48.png" %&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>--------------- test.html.erb ---------------------</p> <pre><code>describe "signin" do before { visit signin_path } let(:page_title) { 'Sign In' } describe "with invalid information" do it { should have_selector('h2', text: 'Sign In')} it { should have_selector('div.alert.alert-error', text: 'Invalid') } end end </code></pre> <p>--------------- session_controller.rb ---------------------</p> <pre><code>def create user = User.find_by_email(params[:session][:email].downcase) if user &amp;&amp; user.authenticate(params[:session][:password]) sign_in user redirect_back_or user else flash.now[:error] = "Invalid email/password combination" render 'new' end end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload