Created
June 21, 2011 23:23
-
-
Save avdi/1039212 to your computer and use it in GitHub Desktop.
This file contains 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 'spec_helper' | |
describe Feeds::Drops::Rss::EntryDrop do | |
use_vcr_cassette | |
subject { | |
Feeds::Drops::Rss::EntryDrop.new(rss_app.feed_entries_to_display[1], context) | |
} | |
let(:context) { mock('context') } | |
let(:rss_app) { | |
app = RssApp.new(:uuid => 123, :url => feed_url, :amount_to_display => 5) | |
app.save :validate => false | |
app | |
} | |
let(:feed_url) { | |
'file://' + File.expand_path("../../../fixtures/rss/Feedburner.xml", __FILE__) | |
} | |
before do | |
RssApp.delete_all | |
end | |
describe '#title' do | |
it 'should return the entry title' do | |
subject.title.should == 'Rails for Zombies' | |
end | |
end | |
describe '#excerpt' do | |
it 'should return the entry excerpt' do | |
subject.excerpt.should == "\n This morning my team over at Envy Labs released a free online tutorial called Rails for Zombies. The website combines screencasts with in-browser coding to provide an interactive learning experience teaching the basics of Ruby on Rails.\n\n\n\t\n\n\t\n\n\tLearning Rails for the first time should be fun, and Rails for Zombies allows you to ge..." | |
end | |
end | |
describe '#content' do | |
it 'should return the entry content' do | |
subject.content.should == "\n <p>This morning my team over at Envy Labs <a href=\"http://blog.envylabs.com/2010/11/rails-for-zombies-released/\" title=\"Rails for Zombies Released!\">released</a> a free online tutorial called <a href=\"http://railsforzombies.org\">Rails for Zombies</a>. The website combines screencasts with in-browser coding to provide an interactive learning experience teaching the basics of Ruby on Rails.</p>\n\n\n\t<p><a href=\"http://railsforzombies.org\" title=\"Rails for Zombies\"><img src=\"/assets/2010/11/18/Rails_for_Zombies-1.jpg\" alt=\"Rails for Zombies\" /></a></p>\n\n\t<p><a href=\"http://railsforzombies.org\" title=\"Rails for Zombies\"><img src=\"/assets/2010/11/18/Rails_for_Zombies-1.jpg\" alt=\"Dupicated Rails for Zombies\" /></a></p>\n\n\t<p>Learning Rails for the first time should be fun, and <a href=\"http://railsforzombies.org\">Rails for Zombies</a> allows you to get your feet wet without any setup or configuration. At the moment the application has five episodes. Each episode consists of a single screencast followed by a group of exercises which must be completed before moving forward. Once you complete all the labs, you unlock a hidden video which shows you where to go to continue your Rails learning.</p>\n\n\n\t<p>If you have any friends who need to get started with Rails, hopefully this will help.</p>\n " | |
end | |
end | |
describe '#date' do | |
it 'should return the entry date' do | |
subject.date.should == 'Nov. 18, 2010' | |
end | |
end | |
describe '#author' do | |
it 'should return the entry author' do | |
subject.author.should == 'Gregg Pollack' | |
end | |
end | |
describe '#url' do | |
it 'should return the entry url' do | |
subject.url.should == 'http://weblog.rubyonrails.org/2010/11/18/rails-for-zombies' | |
end | |
end | |
describe '#image_url' do | |
it 'should return the first image url in an entry' do | |
subject.image_url.should == 'http://weblog.rubyonrails.org/assets/2010/11/18/Rails_for_Zombies-1.jpg' | |
end | |
end | |
describe '#image_alt' do | |
it 'should return the alt of the first image in an entry' do | |
subject.image_alt.should == 'Rails for Zombies' | |
end | |
end | |
context 'when publish date is nil' do | |
let(:feed_url) { 'http://news.ycombinator.com/rss' } | |
its(:date) { should be_nil } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment