rails / journey

A router for rails
221 stars 57 forks source link

1.0.3 -> 1.0.4 update breaks @request.host in tests #41

Open Slotos opened 12 years ago

Slotos commented 12 years ago

Hello

Upon updating journey from 1.0.3 to 1.0.4 test behaviour have changed in regard to subdomains. Consider this test:

      it "returns success for correct domain" do
        @request.host = "something.example.com"
        get 'show'

        response.should be_success
      end

With 1.0.3 it get passes host data and subdomain constraints are evaluated. With 1.0.4 however get doesn't host data, resulting in different or not constraint match, which breaks behaviour completely.

Writing this test like this will work:

      it "returns success for correct domain" do
        get 'show', subdomain: "something"

        response.should be_success
      end

However @request.host method allows for setting subdomains in shared examples, which we employ in our tests.

Slotos commented 12 years ago

I've created an example app for this issue:

https://github.com/Slotos/journey-issue-41-example

Branch master uses journey 1.0.4 and has additional failing test that highlights lacking subdomain hash when using @request.host. Branch journey-1.0.3 uses journey 1.0.3 and has only two tests, one using subdomain option on get and second one utilizing @request.host