Error message to detect unspecified transitive dependencies. This seem to be a probl...
[buildr.git] / spec / groovy / bdd_spec.rb
blobc46c450ec67c51f56fa4d1d4ce32d9932695e3e5
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with this
3 # work for additional information regarding copyright ownership.  The ASF
4 # licenses this file to you under the Apache License, Version 2.0 (the
5 # "License"); you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 #    http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
13 # License for the specific language governing permissions and limitations under
14 # the License.
16 require File.join(File.dirname(__FILE__), '../spec_helpers')
19 describe Buildr::Groovy::EasyB do
20   
21   def foo(*args, &prc)
22     define('foo', *args) do
23       test.using :easyb
24       if prc
25         instance_eval(&prc)
26       else
27         self
28       end
29     end
30   end
32   it 'should apply to a project having EasyB sources' do
33     define('one', :base_dir => 'one') do
34       write _('src/spec/groovy/SomeBehaviour.groovy'), 'true;'
35       Buildr::Groovy::EasyB.applies_to?(self).should be_true
36     end
37     define('two', :base_dir => 'two') do
38       write _('src/test/groovy/SomeBehaviour.groovy'), 'true;'
39       Buildr::Groovy::EasyB.applies_to?(self).should be_false
40     end
41     define('three', :base_dir => 'three') do
42       write _('src/spec/groovy/SomeStory.groovy'), 'true;'
43       Buildr::Groovy::EasyB.applies_to?(self).should be_true
44     end
45     define('four', :base_dir => 'four') do
46       write _('src/test/groovy/SomeStory.groovy'), 'true;'
47       Buildr::Groovy::EasyB.applies_to?(self).should be_false
48     end
49   end
51   it 'should be selected by :easyb name' do
52     foo { test.framework.should eql(:easyb) }
53   end
55   it 'should select a java compiler if java sources are found' do
56     foo do
57       write _('src/spec/java/SomeBehavior.java'), 'public class SomeBehavior {}'
58       test.compile.language.should eql(:java)
59     end
60   end
61   
62   it 'should include src/spec/groovy/*Behavior.groovy' do
63     foo do 
64       spec = _('src/spec/groovy/SomeBehavior.groovy')
65       write spec, 'true'
66       test.invoke
67       test.tests.should include(spec)
68     end
69   end
71   it 'should include src/spec/groovy/*Story.groovy' do
72     foo do 
73       spec = _('src/spec/groovy/SomeStory.groovy')
74       write spec, 'true'
75       test.invoke
76       test.tests.should include(spec)
77     end
78   end
79   
80 end # EasyB