Permalink
Browse files

Added a test for redirects.

  • Loading branch information...
1 parent 0cab271 commit 87b4459956f7569de52145fc22f66595a5de8f53 @jnunemaker committed Mar 26, 2009
Showing with 20 additions and 0 deletions.
  1. +9 −0 test/columbus_test.rb
  2. +11 −0 test/fixtures/railstips_redirect
View
9 test/columbus_test.rb
@@ -24,4 +24,13 @@ class ColumbusTest < Test::Unit::TestCase
]
end
+ should "follow redirects" do
+ FakeWeb.register_uri(:get, "http://railstips.org/", :string => fixture_file('railstips.html'))
+ FakeWeb.register_uri(:get, "http://feeds.feedburner.com/railstips", :response => fixture_file('railstips_redirect'))
+ FakeWeb.register_uri(:get, "http://feeds2.feedburner.com/railstips", :string => fixture_file('railstips_feedburner.html'))
+ primary = Columbus.new('http://railstips.org').primary
+ primary.url.should == 'http://feeds2.feedburner.com/railstips'
+ primary.title.should == 'Railstips Articles'
+ end
+
end
View
11 test/fixtures/railstips_redirect
@@ -0,0 +1,11 @@
+HTTP/1.0 302 Moved Temporarily
+Date: Thu, 26 Mar 2009 01:18:38 GMT
+Server: Apache
+X-FB-Host: chi-write6
+Location: http://feeds2.feedburner.com/railstips
+Content-Length: 0
+P3P: CP="ALL DSP COR NID CUR OUR NOR"
+Keep-Alive: timeout=30, max=100
+Connection: keep-alive
+Content-Type: text/plain; charset=UTF-8
+

0 comments on commit 87b4459

Please sign in to comment.