title: assert_select in IntegrationTest Ruby on Rails
body: <p>I come from a Python and Java background with only basic knowledge to CSS, HTML, Ruby and trying to learn web development using Ruby on Rails. I'm trying to follow the tutorial on <a href="https://www.railstutorial.org/book/sign_up#sec-strong_parameters" rel="nofollow noreferrer">Michael Hartl</a>. I constantly have a problem reading the correct API or even understanding what the API is doing when I do as it seems there's a lot of ways a certain method could be called and examples are not exhaustively shown there. In particular, I do not understand how to what arguments the <code>assert_select</code> method in Listing 7.25 is doing. </p>
  
  <pre><code>require 'test_helper'
  
  class UsersSignupTest &lt; ActionDispatch::IntegrationTest
  
    test "invalid signup information" do
      get signup_path
      assert_no_difference 'User.count' do
        post users_path, params: { user: { name:  "",
                                           email: "user@invalid",
                                           password:              "foo",
                                           password_confirmation: "bar" } }
      end
      assert_template 'users/new'
      assert_select 'div#&lt;CSS id for error explanation&gt;'
      assert_select 'div.&lt;CSS class for field with error&gt;'
    end
    .
    .
    .
  end
  </code></pre>
  
  <p>By referring to <a href="https://apidock.com/rails/ActionDispatch/Assertions/SelectorAssertions/assert_select" rel="nofollow noreferrer">Online APIs</a>, if one were to use <code>assert_select</code> without code blocks, we will use 2 arguments. However, there is only 1 here in each of the 2 examples, with <code>#</code> and <code>.</code>, and I'm not too familiar whether this is some Rails/Ruby/CSS syntax, the origins of the syntax seems mixed.</p>
  
  <p>Can someone enlighten me what am I missing out here? I'm not too familiar when to use <code>#</code> and when to use <code>.</code>, and how we can "cut short" the number of arguments. There seems to always be a lot of play on punctuations like <code>_</code> which are not shown here.</p>