Sha256: 5ede5e817d8e7f2c04f5095efeb36881b9d776e7c0af60cd22a16c2786b0b421

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fetcher-microdata-facebook-0.0.1 spec/fetcher/microdata/article_small/facebook/coercer_spec.rb