spec/codependency/node_spec.rb in codependency-0.1.0 vs spec/codependency/node_spec.rb in codependency-0.2.0

- old
+ new

@@ -1,19 +1,18 @@ require 'spec_helper' describe Codependency::Node do - let( :path ){ File.join( File.dirname( __FILE__ ), '../fixtures' ) } + let( :parser ){ double 'Parser', :parse => [ 'body' ] } - context 'when the file exists' do - subject { Codependency::Node.new "#{path}/planet.rb" } - - its( :dependencies ){ should eq( [ "#{path}/body.rb" ] ) } + context 'when the file exists', :files => :planets do + subject { Codependency::Node.new 'planet.rb', parser } + its( :dependencies ){ should eq( [ 'body.rb' ] ) } end context 'when the file does not exist' do it 'should raise an error' do expect { - Codependency::Node.new "#{path}/pluto.rb" - }.to raise_error( Errno::ENOENT ) + Codependency::Node.new 'pluto.rb', parser + }.to raise_error( Errno::ENOENT, 'No such file or directory - pluto.rb' ) end end end