title: How to assert two maps in Phoenix controller testing with pattern matching
body: <p>In my phoenix controller testing, I am doing something like this,</p>
  
  
  
  <pre class="lang-rb prettyprint-override"><code>describe "update/2" do
    setup [:create_user]
    test "Edits, and responds with the user if attributes are valid", %{conn: conn, user: user} do
  
      response = 
        conn
        |&gt; put(user_path(conn, :update, user.id, @update_attrs))
        |&gt; json_response(200)
  
      expected = %{
        "data" =&gt; 
          %{"currentCity" =&gt; "pune", "mobileNumber" =&gt; "1234567890"}        
        }
  
    assert expected == response  
  
  end
  </code></pre>
  
  <p>And my response map is</p>
  
  <pre class="lang-rb prettyprint-override"><code>%{
    "data" =&gt; %{"currentCity" =&gt; "pune",
                "mobileNumber" =&gt; "1234567890",
                "name" =&gt; "xyz",
                "gender" =&gt; "male"}}
  </code></pre>
  
  <p>Since my response map contains extra keys which is not present in expected map, so the assertion with <code>==</code> fails, so I am trying to do assertion with patter matching like this</p>
  
  <pre class="lang-rb prettyprint-override"><code>assert expected = response
  </code></pre>
  
  <p>but In this case assertion is always true no matter what the are the values in expected and response.</p>
  
  <p>I am confused what's happening with the pattern matching in the case of maps.</p>