Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minimal tests for NETWORK and FALLBACK.

  • Loading branch information...
commit f7c4a05735d0feee28b847df38e105a3a58a8e48 1 parent ebe5c6d
Jimmy Kittiyachavalit authored committed
Showing with 21 additions and 2 deletions.
  1. +21 −2 spec/cached_offline_spec.rb
23 spec/cached_offline_spec.rb
View
@@ -4,12 +4,13 @@
describe "Generating a manifest in cached mode" do
include Rack::Test::Methods
- def self.new_app
+ def self.new_app(&block)
root = File.expand_path("../fixture_root", __FILE__)
Rack::Offline.configure(:root => root, :cache => true) do
cache "hello.html"
cache "hello.css"
cache "javascripts/hello.js"
+ instance_eval(&block) if block_given?
end
end
@@ -80,4 +81,22 @@ def reload_server
it "doesn't contain a fallback section" do
body.should_not =~ %r{^FALLBACK:}
end
-end
+
+ it "does contain a network section" do
+ self.class.app = self.class.new_app{ network "/" }
+ with_session :new_app_with_network do
+ get "/" do
+ body.should =~ %r{^NETWORK:}
+ end
+ end
+ end
+
+ it "does contain a fallback section" do
+ self.class.app = self.class.new_app{ fallback("/" => "/offline.html") }
+ with_session :new_app_with_offline do
+ get "/"
+ body.should =~ %r{^FALLBACK:}
+ end
+ end
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.