Sha256: 5d3316db7bbb70b32bd260020e8a322b45ef6d725a5faf8532c5570c52b48b46
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
# encoding: utf-8 require 'spec_helper' describe EndiFeed::News do let(:news) { EndiFeed::News.new } before :each do stub_request(:get, 'http://www.elnuevodia.com/rss/noticias.xml') .with(:headers => { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) .to_return(:status => 200, :body => fixture('noticias.xml'), :headers => {}) stub_request(:post, 'https://www.googleapis.com/urlshortener/v1/url') .with(:headers => { 'Accept' => '*/*', 'User-Agent' => 'Ruby' }) .to_return(:status => 200, :body => 'http://goo.gl/fbsS', :headers => {}) end describe '.title' do it 'returns title of the feed' do expect(news.title).to eq('El Nuevo Dia : Noticias') end end describe '.site_url' do it 'returns the url of the site' do expect(news.site_url).to eq('http://www.elnuevodia.com/') end end describe '.last_update' do it 'returns the last update time of the feed' do expect(news.last_update).to eq('04:27:33 PM') end end describe '.get_headlines' do it 'returns formatted news' do expect(news.get_headlines(2).size).to eq(4) end it 'returns error msg when something goes wrong' do expect(news.get_headlines('ee')).to eq('Problem retrieving news headlines.') end end describe '.format_header_text' do it 'formats the header text' do expect(news.format_header_text([])) .to eq(['El Nuevo Dia : Noticias (http://www.elnuevodia.com/)', 'Ćltima actualizaciĆ³n: 04:27:33 PM']) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
endi_feed-0.0.3 | spec/lib/news_spec.rb |
endi_feed-0.0.2 | spec/lib/news_spec.rb |