spec/codependency/parser_spec.rb in codependency-0.1.0 vs spec/codependency/parser_spec.rb in codependency-0.2.0
- old
+ new
@@ -1,31 +1,49 @@
require 'spec_helper'
describe Codependency::Parser do
- let( :path ){ File.join( File.dirname( __FILE__ ), '../fixtures' ) }
- let( :parser ){ Codependency::Parser.new }
+ context 'planets', :files => :planets do
+ let( :parser ){ Codependency::Parser.new }
- context 'body' do
- subject { parser.parse( "#{path}/body.rb" ) }
- it { should eq( [ ] ) }
+ context 'body' do
+ subject { parser.parse( 'body.rb' ) }
+ it { should eq( [ ] ) }
+ end
+ context 'earth' do
+ subject { parser.parse( 'earth.rb' ) }
+ it { should eq( [ 'planet' ] ) }
+ end
+ context 'mars' do
+ subject { parser.parse( 'mars.rb' ) }
+ it { should eq( [ 'planet' ] ) }
+ end
+ context 'phobos' do
+ subject { parser.parse( 'phobos.rb' ) }
+ it { should eq( [ 'body', 'mars' ] ) }
+ end
+ context 'planet' do
+ subject { parser.parse( 'planet.rb' ) }
+ it { should eq( [ 'body' ] ) }
+ end
end
- context 'earth' do
- subject { parser.parse( "#{path}/earth.rb" ) }
- it { should eq( [ 'planet' ] ) }
- end
+ context 'breakfasts', :files => :breakfasts do
+ let( :parser ){ Codependency::Parser.new :comment => '//' }
- context 'mars' do
- subject { parser.parse( "#{path}/mars.rb" ) }
- it { should eq( [ 'planet' ] ) }
- end
-
- context 'phobos' do
- subject { parser.parse( "#{path}/phobos.rb" ) }
- it { should eq( [ 'body', 'mars' ] ) }
- end
-
- context 'planet' do
- subject { parser.parse( "#{path}/planet.rb" ) }
- it { should eq( [ 'body' ] ) }
+ context 'butter' do
+ subject { parser.parse( 'butter.js' ) }
+ it { should eq( [ ] ) }
+ end
+ context 'egg' do
+ subject { parser.parse( 'egg.js' ) }
+ it { should eq( [ 'butter' ] ) }
+ end
+ context 'toast' do
+ subject { parser.parse( 'toast.js' ) }
+ it { should eq( [ 'butter' ] ) }
+ end
+ context 'sandwich' do
+ subject { parser.parse( 'sandwich.js' ) }
+ it { should eq( [ 'egg', 'toast' ] ) }
+ end
end
end