require 'spec_helper' describe 'Fetcher::Microdata::ArticleSmall::Facebook::Coercer' do context 'the adapter receives a valid post' do before do @post = JSON.parse File.read "spec/post.json" @viewer = JSON.parse File.read "spec/viewer.json" @translated_post = Fetcher::Microdata::ArticleSmall::Facebook::Coercer.call @post, @viewer end it "should initialize the id" do @translated_post[:id].should == @post["id"] end it "should initialize the likes_type" do @translated_post[:likes_type].should == "http://schema.org/AggregateRating/Likes" end it "should initialize the articleBody" do @translated_post[:articleBody].should == @post["message"] end it "should initialize the author with a instance of person user" do @translated_post[:author].should be_an_instance_of Fetcher::Microdata::PersonUser end it "should initialize the dateCreated post" do @translated_post[:dateCreated].should == @post["created_time"] end it "should initialize the likes count" do @translated_post[:likes_count].should == @post["likes"]["count"] end it "should initialize the comments count" do @translated_post[:comments_count].should == @post["comments"]["count"] end it "should initialize the viewer" do @translated_post[:viewer].should be_an_instance_of Fetcher::Microdata::PersonUser end it "should initialize the provider" do @translated_post[:provider].should == ["facebook"] end end end