require 'spec_helper' describe Fetcher::Microdata::Review do describe '.new' do it 'should set the _type to schema.org/Review' do @arg = stub "arg" article = Fetcher::Microdata::Review.new @arg, @argument, @viewer article._type.should == "http://schema.org/Review" end end it 'should inherit from Fetcher::Microdata' do Fetcher::Microdata::Review.superclass.should == Fetcher::Microdata end it 'should raise wrong number of argument if the count of arguments is distinct of 3' do expect { Fetcher::Microdata::Review.new "a", "b", "c", "d" }.to raise_error end describe 'attributes' do before do @arg1 = stub "args1" @arg2 = stub "args2" @arg3 = stub "args3" Fetcher::Microdata::Review.any_instance.stub :coerce end it 'should set attribute additionalType' do Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3) .attributes.should have_key :additionalType end it 'should set attribute id' do Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3) .attributes.should have_key :id end it 'should set attribute articleBody' do Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3) .attributes.should have_key :reviewBody end it 'should set attribute author' do Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3) .attributes.should have_key :author end it 'should set attribute viewer' do Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3) .attributes.should have_key :viewer end it 'should set attribute dateCreated' do Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3) .attributes.should have_key :dateCreated end it 'should set attribute provider' do Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3) .attributes.should have_key :provider end it 'should set attribute url' do Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3) .attributes.should have_key :url end it 'should set attribute original_tweet' do Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3) .attributes.should have_key :itemReviewed end end end