require 'spec_helper' describe Fetcher::Microdata::UserComments do describe '.new' do it 'should set the _type to schema.org/UserComments' do @arg = stub "arg" article = Fetcher::Microdata::UserComments.new @arg, @argument article._type.should == "http://schema.org/UserComments" end end it 'should raise wrong number of argument if the count of arguments is distinct of 2' do expect { Fetcher::Microdata::UserComments.new "a", "b", "c", "d" }.to raise_error end it 'should inherit from Fetcher::Microdata' do Fetcher::Microdata::UserComments.superclass.should == Fetcher::Microdata end describe 'attributes' do before do @arg1 = stub "args1" @arg2 = stub "args2" Fetcher::Microdata::UserComments.any_instance.stub :coerce end it 'should set attribute additionalType' do Fetcher::Microdata::UserComments.new(@arg1, @arg2) .attributes.should have_key :additionalType end it 'should set attribute id' do Fetcher::Microdata::UserComments.new(@arg1, @arg2) .attributes.should have_key :id end it 'should set attribute commentText' do Fetcher::Microdata::UserComments.new(@arg1, @arg2) .attributes.should have_key :commentText end it 'should set attribute creator' do Fetcher::Microdata::UserComments.new(@arg1, @arg2) .attributes.should have_key :creator end it 'should set attribute commentTime' do Fetcher::Microdata::UserComments.new(@arg1, @arg2) .attributes.should have_key :commentTime end end end