aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStormwind <stormwind@stormwinds-page.de>2012-11-30 18:58:32 +0100
committerStormwind <stormwind@stormwinds-page.de>2012-11-30 18:58:32 +0100
commitfacd4f143bb3f0bb44d89b6ff11e61a0b7c36427 (patch)
tree06974380eb50c3ad5cee8bbe17247d160e94fd1f /spec
parentd28dc720d10a3380b5649e29db053ca9a989efd5 (diff)
Add redirect to response
Now a relocation can be done, by calling redirect with the URL you want relocate to. This will set the Location header and set the status code to 302.
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/response/response_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/unit/response/response_spec.rb b/spec/unit/response/response_spec.rb
index 9d2097a..8edc48d 100644
--- a/spec/unit/response/response_spec.rb
+++ b/spec/unit/response/response_spec.rb
@@ -125,4 +125,14 @@ describe Zero::Response do
end
end
+ describe '#redirect' do
+ it "sets the status to 302 and the given Location URL in header" do
+ subject.redirect 'http://foo.bar/relocated/thingy'
+ value = subject.to_a
+
+ value[0].should eq(302)
+ value[1]['Location'].should eq('http://foo.bar/relocated/thingy')
+ end
+ end
+
end \ No newline at end of file