diff options
-rw-r--r-- | SPEC | 2 | ||||
-rw-r--r-- | lib/rack/lint.rb | 5 | ||||
-rw-r--r-- | test/spec_lint.rb | 4 |
3 files changed, 9 insertions, 2 deletions
@@ -11,7 +11,7 @@ The *status*, the *headers*, and the *body*. == The Environment -The environment must be an instance of Hash that includes +The environment must be an unfrozen instance of Hash that includes CGI-like headers. The application is free to modify the environment. The environment is required to include these variables diff --git a/lib/rack/lint.rb b/lib/rack/lint.rb index a5365e57..0cccaed2 100644 --- a/lib/rack/lint.rb +++ b/lib/rack/lint.rb @@ -73,12 +73,15 @@ module Rack ## == The Environment def check_env(env) - ## The environment must be an instance of Hash that includes + ## The environment must be an unfrozen instance of Hash that includes ## CGI-like headers. The application is free to modify the ## environment. assert("env #{env.inspect} is not a Hash, but #{env.class}") { env.kind_of? Hash } + assert("env should not be frozen, but is") { + !env.frozen? + } ## ## The environment is required to include these variables diff --git a/test/spec_lint.rb b/test/spec_lint.rb index 66339c68..408a32b7 100644 --- a/test/spec_lint.rb +++ b/test/spec_lint.rb @@ -26,6 +26,10 @@ describe Rack::Lint do lambda { Rack::Lint.new(nil).call 5 }.must_raise(Rack::Lint::LintError). message.must_match(/not a Hash/) + lambda { Rack::Lint.new(nil).call({}.freeze) }.must_raise(Rack::Lint::LintError). + message.must_match(/env should not be frozen, but is/) + + lambda { e = env e.delete("REQUEST_METHOD") |