File: extension_builder_test.rb

package info (click to toggle)
gem2deb 2.2.6
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,228 kB
  • sloc: ruby: 5,562; sh: 140; perl: 46; ansic: 33; makefile: 31
file content (34 lines) | stat: -rw-r--r-- 1,031 bytes parent folder | download | duplicates (3)
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
require_relative '../test_helper'
require 'gem2deb/extension_builder'

class ExtensionBuilderTest < Gem2DebTestCase

  gem = SIMPLE_EXTENSION_NAME
  build_dir = 'ruby-' + SIMPLE_EXTENSION_DIRNAME
  target_dir = File.join(tmpdir, build_dir)
  package = 'ruby-' + SIMPLE_EXTENSION_NAME.gsub('_', '-')

  one_time_setup do
    FileUtils.cp_r(File.join('test/sample/', gem), target_dir)
    Dir.chdir(target_dir) do
      silently do
        Gem2Deb::ExtensionBuilder.build_all_extensions('.', "debian/#{package}")
      end
    end
  end

  context 'building simpleextension' do
    should 'install .so for current Ruby' do
      Dir.chdir(target_dir) do
        assert_file_exists File.join('debian', package, RbConfig::CONFIG['vendorarchdir'] + '/simpleextension.so')
      end
    end

    should 'not install mkmf.log' do
      Dir.chdir(target_dir) do
        assert Dir.glob(File.join('debian', package, RbConfig::CONFIG['vendorarchdir'], 'mkmf.log')).empty?, 'mkmf.log installed to extension dir!'
      end
    end
  end

end