This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test john$ ruby feed_aggregator_test.rb | |
| Run options: | |
| # Running tests: | |
| EE. | |
| Finished tests in 0.031776s, 94.4109 tests/s, 62.9406 assertions/s. | |
| 1) Error: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sinatra' | |
| require 'nokogiri' | |
| def parse feed | |
| doc = Nokogiri::XML feed | |
| doc.search('item').map do |doc_item| | |
| item = {} | |
| item[:link] = doc_item.at('link').text | |
| item[:thumbnail] = doc_item.at('media:thumbnail').attr('url').value | |
| item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test$ ruby feed_aggregator_test.rb | |
| Run options: | |
| # Running tests: | |
| .F.. | |
| Finished tests in 0.053503s, 74.7622 tests/s, 93.4527 assertions/s. | |
| 1) Failure: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def test_find_the_thumbnail_image | |
| feed = File.read('fixtures/feed.xml') | |
| items = parse feed | |
| item = items.first | |
| thumbnail = 'http://farm9.staticflickr.com/8488/8205498382_4e5ed09a62_s.jpg' | |
| assert_equal item[:thumbnail], thumbnail | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sinatra' | |
| require 'nokogiri' | |
| def parse feed | |
| doc = Nokogiri::XML feed | |
| doc.search('item').map do |doc_item| | |
| item = {} | |
| item[:link] = doc_item.at('link').text | |
| item | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test$ gem list --local -d noko | |
| *** LOCAL GEMS *** | |
| nokogiri (1.5.5) | |
| Authors: Aaron Patterson, Mike Dalessio, Yoko Harada, Tim Elliott | |
| Rubyforge: http://rubyforge.org/projects/nokogiri | |
| Homepage: http://nokogiri.org | |
| Installed at: /Users/john/.rvm/gems/ruby-1.9.3-p194@feed_aggregator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test$ sudo gem install nokogiri |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test$ gem list --local -d noko | |
| *** LOCAL GEMS *** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test$ ruby feed_aggregator_test.rb | |
| Run options: | |
| # Running tests: | |
| E. | |
| Finished tests in 0.027235s, 73.4349 tests/s, 73.4349 assertions/s. | |
| 1) Error: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sinatra' | |
| def parse feed | |
| end | |
| get '/' do | |
| "Feed Aggregator" | |
| end |