Sha256: 550cfc67d51bdd086598483ceaa51c22bcc86ef36d4a5f7fc2fd44f02aed6e2d

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Pupa::Concerns::Linkable do
  let :klass do
    Class.new do
      include Pupa::Model
      include Pupa::Concerns::Linkable
    end
  end

  let :object do
    klass.new
  end

  describe '#add_link' do
    it 'should add a link' do
      object.add_link('http://example.com', note: 'homepage')
      object.links.should == [{url: 'http://example.com', note: 'homepage'}]
    end

    it 'should not add a link without a url' do
      object.add_link(nil)
      object.links.blank?.should == true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pupa-0.0.10 spec/models/concerns/linkable_spec.rb
pupa-0.0.9 spec/models/concerns/linkable_spec.rb