spec/codependency/graph_spec.rb in codependency-0.1.0 vs spec/codependency/graph_spec.rb in codependency-0.2.0
- old
+ new
@@ -1,16 +1,26 @@
require 'spec_helper'
describe Codependency::Graph do
- let( :path ){ File.join( File.dirname( __FILE__ ), '../fixtures' ) }
- subject { Codependency::Graph.new Dir[ File.join( path, '*.rb' ) ] }
+ context 'planets', :files => :planets do
+ subject { Codependency::Graph.new graph }
- its( :files ){ should eq(
- [
- "#{path}/body.rb",
- "#{path}/planet.rb",
- "#{path}/earth.rb",
- "#{path}/mars.rb",
- "#{path}/phobos.rb"
- ]
- ) }
+ context 'earth' do
+ let( :graph ){ 'earth.rb' }
+ its( :files ){ should eq( %w| body.rb planet.rb earth.rb | ) }
+ end
+
+ context 'phobos' do
+ let( :graph ){ 'phobos.rb' }
+ its( :files ){ should eq( %w| body.rb planet.rb mars.rb phobos.rb | ) }
+ end
+ end
+
+ context 'breakfasts', :files => :breakfasts do
+ subject { Codependency::Graph.new graph, :comment => '//' }
+
+ context 'sandwich' do
+ let( :graph ){ 'sandwich.js' }
+ its( :files ){ should eq( %w| butter.js toast.js egg.js sandwich.js | ) }
+ end
+ end
end