Sha256: 3d952cb13ca5c23f1e0ab94d3e55edf3814224265c1b4c9789d59f9f2333a2ae
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
require 'spec_helper' describe ActivityStreams::MediaLink do let :required_attributes do { :url => 'http://example.com/images/icon.png' } end let :optional_attributes do { :duration => 100.0, :height => '200', :width => '300.0' } end context 'when missing attributes' do it do expect { ActivityStreams::MediaLink.new }.should raise_error AttrRequired::AttrMissing end end context 'otherwise' do subject { ActivityStreams::MediaLink.new required_attributes } its(:url) { should be_a Addressable::URI } context 'when optional attributes given' do subject { ActivityStreams::MediaLink.new required_attributes.merge(optional_attributes) } its(:duration) { should be_a Integer } its(:height) { should be_a Integer } its(:width) { should be_a Integer } end context 'otherwise' do its(:duration) { should be_nil } its(:height) { should be_nil } its(:width) { should be_nil } end end describe '#as_json' do let(:attributes) { required_attributes.merge(optional_attributes) } subject { ActivityStreams::MediaLink.new(required_attributes.merge(optional_attributes)).as_json } it do should == { :url => required_attributes[:url], :duration => optional_attributes[:duration].to_i, :height => optional_attributes[:height].to_i, :width => optional_attributes[:width].to_i } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
activitystreams-0.0.4 | spec/activitystreams/media_link_spec.rb |
activitystreams-0.0.3 | spec/activitystreams/media_link_spec.rb |
activitystreams-0.0.2 | spec/activitystreams/media_link_spec.rb |