Permalink
Browse files

Added tests for link and feed.

  • Loading branch information...
1 parent 6def624 commit 5dc615d24799a6a8a096c055a5df1f4494a7a052 @jnunemaker committed Mar 26, 2009
Showing with 2,543 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +2 −2 lib/columbus.rb
  3. +2 −2 lib/columbus/feed.rb
  4. +23 −0 test/feed_test.rb
  5. +1,071 −0 test/fixtures/railstips.html
  6. +1,397 −0 test/fixtures/railstips_feedburner.html
  7. +40 −0 test/link_test.rb
  8. +7 −0 test/test_helper.rb
View
@@ -3,3 +3,4 @@
coverage
rdoc
pkg
+*.gem
View
@@ -17,8 +17,8 @@ def initialize(url)
def primary
@primary ||= begin
- response = RedirectFollower.new(url).resolve
- @url = response.url
+ response = RedirectFollower.new(url).resolve
+ @url = response.url
if hpricot_link = parse_links(response.body)[0]
link_to_feed(hpricot_link)
end
View
@@ -4,10 +4,10 @@ class Feed < Struct.new(:url, :title)
def initialize(*args)
super(*args)
- determine_feed_endpoint!
+ determine_feed_endpoint
end
- def determine_feed_endpoint!
+ def determine_feed_endpoint
response = RedirectFollower.new(url).resolve
self.url = response.url
self.body = response.body
View
@@ -0,0 +1,23 @@
+require 'test_helper'
+
+class FeedTest < Test::Unit::TestCase
+ context "Initialization" do
+ setup do
+ @body = fixture_file('railstips.html')
+ FakeWeb.register_uri(:get, "http://feeds.feedburner.com/railstips", :string => @body)
+ @feed = Columbus::Feed.new('http://feeds.feedburner.com/railstips', 'Railstips')
+ end
+
+ should "accept a url" do
+ @feed.url.should == 'http://feeds.feedburner.com/railstips'
+ end
+
+ should "accept a title" do
+ @feed.title = 'Railstips'
+ end
+
+ should "set body to feed endpoint response body" do
+ @feed.body.should == @body
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 5dc615d

Please sign in to comment.