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
16 require File.join(File.dirname(__FILE__), '../spec_helpers')
19 describe Buildr::Groovy::EasyB do
22 define('foo', *args) do
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
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
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
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
51 it 'should be selected by :easyb name' do
52 foo { test.framework.should eql(:easyb) }
55 it 'should select a java compiler if java sources are found' do
57 write _('src/spec/java/SomeBehavior.java'), 'public class SomeBehavior {}'
58 test.compile.language.should eql(:java)
62 it 'should include src/spec/groovy/*Behavior.groovy' do
64 spec = _('src/spec/groovy/SomeBehavior.groovy')
67 test.tests.should include(spec)
71 it 'should include src/spec/groovy/*Story.groovy' do
73 spec = _('src/spec/groovy/SomeStory.groovy')
76 test.tests.should include(spec)