GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Apache Buildr
Homepage: http://incubator.apache.org/buildr
Clone URL: git://github.com/vic/buildr.git
vic (author)
Mon May 05 14:01:10 -0700 2008
commit  23d85f86e473e2339ef436f60e44a40403936543
tree    7dcca3b46bd1e32c26d0adae93b01106070877d0
parent  5393b44e8181067dc07df6b44d3dc98e85e249fc
buildr / spec / packaging_helper.rb
100644 64 lines (56 sloc) 2.266 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with this
# work for additional information regarding copyright ownership. The ASF
# licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
 
 
shared_examples_for 'packaging' do
  it 'should create artifact of proper type' do
    packaging = @packaging
    package_type = @package_type || @packaging
    define 'foo', :version=>'1.0' do
      package(packaging).type.should eql(package_type) rescue exit!
    end
  end
 
  it 'should create file with proper extension' do
    packaging = @packaging
    package_type = @package_type || @packaging
    define 'foo', :version=>'1.0' do
      package(packaging).to_s.should match(/.#{package_type}$/)
    end
  end
 
  it 'should always return same task for the same package' do
    packaging = @packaging
    define 'foo', :version=>'1.0' do
      package(packaging)
      package(packaging, :id=>'other')
    end
    project('foo').packages.uniq.size.should eql(2)
  end
 
  it 'should complain if option not known' do
    packaging = @packaging
    define 'foo', :version=>'1.0' do
      lambda { package(packaging, :unknown_option=>true) }.should raise_error(ArgumentError, /no such option/)
    end
  end
 
  it 'should respond to with() and return self' do
    packaging = @packaging
    define 'foo', :version=>'1.0' do
      package(packaging).with({}).should be(package(packaging))
    end
  end
 
  it 'should respond to with() and complain if unknown option' do
    packaging = @packaging
    define 'foo', :version=>'1.0' do
      lambda { package(packaging).with(:unknown_option=>true) }.should raise_error(ArgumentError, /does not support the option/)
    end
  end
end