Sha256: 1a4b7ddbd9f8d2a13f6afbcd82b4a4f33fab73721a5c95e174f0a34a0cf9f09f

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe EndiFeed::Util do
  let(:util) { EndiFeed::Util }

  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 '.parse_feed' do
    it 'returns an RSS::Rss instance' do
      expect(util.parse_feed).to be_kind_of(RSS::Rss)
    end
  end

  describe '.convert_date' do
    it 'converts HTTP-date into a mm/dd/yy parsed date' do
      expect(util.convert_date('Sat, 29 Jun 2013 16:27:33 GMT'))
      .to eq('06/29/13')
    end
  end

  describe '.convert_time' do
    it 'converts HTTP-date into a 12-hour parsed time' do
      expect(util.convert_time('Sat, 29 Jun 2013 16:27:33 GMT'))
      .to eq('12:27:33 PM')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
endi_feed-0.0.1 spec/lib/util_spec.rb