Skip to content

Commit

Permalink
Add a few tests for edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
brainopia committed Oct 1, 2010
1 parent a92ec4d commit 99df568
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/spec_rack_common_cookies.rb
Expand Up @@ -89,4 +89,19 @@ def make_request(domain, cookies='key=value')
response = make_request 'sub.domain.bz', "key=value; domain=domain.bz"
response.headers['Set-Cookie'].should == "key=value; domain=.domain.bz"
end

specify 'should not touch cookies if domain is localhost' do
response = make_request 'localhost'
response.headers['Set-Cookie'].should == "key=value"
end

specify 'should not touch cookies if domain is ip address' do
response = make_request '127.0.0.1'
response.headers['Set-Cookie'].should == "key=value"
end

specify 'should use .domain.com for cookies from subdomain.domain.com:3000' do
response = make_request 'subdomain.domain.com:3000'
response.headers['Set-Cookie'].should == "key=value; domain=.domain.com"
end
end

0 comments on commit 99df568

Please sign in to comment.