Sha256: 104c753ea76f04f2fcb31159ed412e3a0e2b76fd3e1eacd0884660100b18261c

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

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

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

  let :object do
    klass.new
  end

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

    it 'should not add a source without a url' do
      object.add_source(nil)
      object.sources.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/sourceable_spec.rb
pupa-0.0.9 spec/models/concerns/sourceable_spec.rb