title: RSpec routing spec: sequence of fields in hash
body: <p>I'm having a problem with the actual vs expected failing due to sequence on the hash. I don't recall seeing this before ... and in any case I thought a hash was unordered?</p>
  
  <p>How can I have this test pass?</p>
  
  <pre><code>RSpec.describe ArticleSectionsController, type: :routing do
    describe "routing" do
  
      it "routes to #index" do
        expect(:get =&gt; "/articles/5/article_sections").to route_to("article_sections#index", article_id: 5)
      end
    end
  end
  </code></pre>
  
  
  
  <pre><code>  1) ArticleSectionsController routing routes to #index
       Failure/Error: expect(:get =&gt; "/articles/5/article_sections").to route_to("article_sections#index", article_id: 5)
  
         The recognized options &lt;{"controller"=&gt;"article_sections", "action"=&gt;"index", "article_id"=&gt;"5"}&gt; did not match &lt;{"article_id"=&gt;5, "controller"=&gt;"article_sections", "action"=&gt;"index"}&gt;, difference:.
         --- expected
         +++ actual
         @@ -1 +1 @@
          -{"article_id"=&gt;5, "controller"=&gt;"article_sections", "action"=&gt;"index"}
         +{"controller"=&gt;"article_sections", "action"=&gt;"index", "article_id"=&gt;"5"}
  </code></pre>