それはとても簡単です (あまりいいことではありません:) が、確認したい場合は、Content-Encoding
応答ヘッダーを見てくださいgzip
。Webkit ブラウザーでは、開発者ツールの [ネットワーク] の下にapp.min.css
あり、[ヘッダー] タブなどのリソースを選択します。
これをテストする方法は、次のブログ投稿に記載されています。
http://artsy.github.io/blog/2012/02/24/10x-rack-and-rails-output-compression-with-rack-deflater/
仕様を共有の例に変更したので、本当に確認したい場所に追加できます。
shared_examples "Compressed pages" do
subject { last_response.headers }
its(["Content-Encoding"]) { should be_nil }
context "After compression" do
before do
get page
@etag = last_response.headers["Etag"]
@content_length = last_response.headers["Content-Length"]
get page, {}, { "HTTP_ACCEPT_ENCODING" => "gzip" }
end
its(["Etag"]) { should == @etag }
its(["Content-Length"]) { should_not == @content_length }
its(["Content-Encoding"]) { should == "gzip"}
end
end
私の主な仕様は次のように使用します:
describe "Public pages" do
describe "Home page", :type => :request do
let(:page) { "/" }
it_behaves_like "Compressed pages"
そのit_behaves_like "Compressed pages"
共有された例を実行し、正しいヘッダーなどがあることを確認します。