aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_software_spec.rb
blob: 7d67d90d3a63179db351fb4b78ac67078ae8a28c (plain)
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
require 'testing_env'
require 'software_spec'
require 'bottles'

class HeadSoftwareSpecTests < Test::Unit::TestCase
  include VersionAssertions

  def setup
    @spec = HeadSoftwareSpec.new
  end

  def test_version
    assert_version_equal 'HEAD', @spec.version
  end

  def test_verify_download_integrity
    assert_nil @spec.verify_download_integrity(Object.new)
  end
end

class BottleTests < Test::Unit::TestCase
  def setup
    @spec = Bottle.new
  end

  def test_checksum_setters
    checksums = {
      :snow_leopard_32 => 'deadbeef'*5,
      :snow_leopard    => 'faceb00c'*5,
      :lion            => 'baadf00d'*5,
      :mountain_lion   => '8badf00d'*5,
    }

    checksums.each_pair do |cat, sha1|
      @spec.sha1(sha1 => cat)
    end

    checksums.each_pair do |cat, sha1|
      assert_equal Checksum.new(:sha1, sha1),
        @spec.instance_variable_get(:@sha1)[cat]
    end
  end

  def test_other_setters
    double = Object.new
    %w{root_url prefix cellar revision}.each do |method|
      @spec.send(method, double)
      assert_equal double, @spec.send(method)
    end
  end
end