Sha256: 05a9212dbdea4be8f2366b9ad06acd5eb117c6c433f90f969765c4ad99c94da4

Contents?: true

Size: 787 Bytes

Versions: 2

Compression:

Stored size: 787 Bytes

Contents

require 'spec_helper'

describe Codependency::Node do
  let( :parser ){ double 'Parser', :parse => [ 'body' ] }

  context 'when the file exists', :files => :planets do
    subject { Codependency::Node.new 'planet.rb', parser }
    its( :edges ){ should eq( [ 'body.rb' ] ) }
  end

  context 'when the file does not exist' do
    it 'should raise an error' do
      expect {
        Codependency::Node.new 'pluto.rb', parser
      }.to raise_error( Errno::ENOENT, 'No such file or directory - pluto.rb' )
    end
  end

  describe 'dependencies', :files => :planets do
    let( :parser ){ double 'Parser', :parse => [ 'body', 'mars' ] }
    subject { Codependency::Node.new 'phobos.rb', parser }

    its( :dependencies ){ should eq( 'phobos.rb body.rb phobos.rb mars.rb' ) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codependency-0.3.1 spec/codependency/node_spec.rb
codependency-0.3.0 spec/codependency/node_spec.rb