Skip to content

Instantly share code, notes, and snippets.

@commuterjoy
Created March 16, 2012 15:21
Show Gist options
  • Save commuterjoy/2050512 to your computer and use it in GitHub Desktop.
Save commuterjoy/2050512 to your computer and use it in GitHub Desktop.
gzip test
require 'json'
Before do
@random_token = rand(10000)
end
Then /^the page should be compressed$/ do
response = RestClient.get("#{host}/news?#{@random_token}", { :accept_encoding => 'gzip' })
response.headers[:content_encoding].should include 'gzip'
response.headers[:vary].should include 'Accept-Encoding'
end
Then /^the page should \*not\* be compressed$/ do
response = RestClient.get("#{host}/news?#{@random_token}", { :accept_encoding => 'gzip', :x_news_setshowadverts => 'yes' })
response.headers[:content_encoding].should_not include 'gzip'
response.headers[:vary].should_not include 'Accept-Encoding'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment