Sha256: 7ef7b2f0cfe24b527ce8efba203fd557849f83807aa4536954994ea3e7f32892
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 KB
Contents
require 'spec_helper' describe 'Fetcher::Microdata::ArticleSmall::Twitter::Coercer' do context 'the adapter receives a valid tweet and a valid viewer' do before do @tweet = JSON.parse File.read 'spec/tweet.json' @viewer = JSON.parse File.read 'spec/viewer.json' @adapter = Fetcher::Microdata::ArticleSmall::Twitter::Coercer.call @tweet, @viewer end it 'should set #id with the value of "id"' do @adapter[:id].should == @tweet["id"] end it 'should set #additionalType as the getfetcher/Item type' do @adapter[:additionalType].should == "http://getfetcher.net/Item" end it 'should set #articleBody with the value of "text"' do @adapter[:articleBody].should == @tweet["text"] end it 'should set #author with the Person from the value of "user" > "name"' do @adapter[:author].attributes.should == Fetcher::Microdata::PersonUser.new(:twitter, @tweet["user"]).attributes end it 'should set #viewer with the Person from the value of "user" > "name"' do @adapter[:viewer].attributes.should == Fetcher::Microdata::PersonUser.new(:twitter, @viewer).attributes end it 'should set #dateCreated with the timestamp obtained from "created_at"' do @adapter[:dateCreated].should == 1329859747 end it 'should set #provider as an array, coming Twitter first and then the "source"' do @adapter[:provider].should == ["twitter", @tweet["source"]] end it 'should set #url compiling the basic url with the "id" and the "user" > "screen_name"' do @adapter[:url].should == "https://twitter.com/#{@tweet["user"]["screen_name"]}/status/#{@tweet["id"]}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems