Sha256: 66ffbd794804732650b4fd3d23a71b59f120a83775b9001bd8fb25416b879892

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Codependency::Graph do
  context 'planets', :files => :planets do
    subject { Codependency::Graph.new graph }

    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 egg.js toast.js sandwich.js | ) }
    end
  end

  context 'circular dependencies', :files => :circular do
    subject { Codependency::Graph.new graph }

    let( :graph ){ 'money.rb' }

    it 'should raise an error' do
      expect { subject.files }.to raise_error( CircularDependencyError )
    end
  end

  context 'subdirectories', :files => :subdirectories do
    subject { Codependency::Graph.new graph, :comment => '//' }

    context 'application.js' do
      let( :graph ){ 'application.js' }
      its( :files ){ should eq( %w| templates/user/history.js templates/user/account.js templates/user.js application.js | ) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codependency-0.3.1 spec/codependency/graph_spec.rb