Sha256: ac528216cbb8c91f3304c723408ceadd382c236cf0af8c0a9de145a593a574a5

Contents?: true

Size: 1.21 KB

Versions: 19

Compression:

Stored size: 1.21 KB

Contents

require 'autobuild/test'

class TC_Subcommand < Minitest::Test
EXAMPLE_1 = <<EOF
This is a file
It will be the first part of the two-part cat
EOF

EXAMPLE_2 = <<EOF
This is another file
It will be the second part of the two-part cat
EOF
    attr_reader :source1, :source2
    def setup
        super

        Autobuild.logdir = tempdir

        # Write example files
        @source1 = File.join(tempdir, 'source1')
        @source2 = File.join(tempdir, 'source2')
        File.open(source1, 'w+') { |f| f.write(EXAMPLE_1) }
        File.open(source2, 'w+') { |f| f.write(EXAMPLE_2) }
    end

    def test_behaviour_on_unexpected_error
        flexmock(Autobuild::Subprocess).should_receive(:exec).and_raise(::Exception)
        assert_raises(Autobuild::SubcommandFailed) { Autobuild::Subprocess.run('test', 'test', 'does_not_exist') }
    end
    def test_behaviour_on_inexistent_command
        assert_raises(Autobuild::SubcommandFailed) { Autobuild::Subprocess.run('test', 'test', 'does_not_exist') }
    end
    def test_behaviour_on_interrupt
        flexmock(Autobuild::Subprocess).should_receive(:exec).and_raise(Interrupt)
        assert_raises(Interrupt) { Autobuild::Subprocess.run('test', 'test', 'does_not_exist') }
    end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
autobuild-1.9.6 test/test_subcommand.rb
autobuild-1.9.5 test/test_subcommand.rb
autobuild-1.9.4 test/test_subcommand.rb
autobuild-1.9.4.rc1 test/test_subcommand.rb
autobuild-1.9.3 test/test_subcommand.rb
autobuild-1.9.3.b4 test/test_subcommand.rb
autobuild-1.9.3.b3 test/test_subcommand.rb
autobuild-1.9.3.b2 test/test_subcommand.rb
autobuild-1.9.3.b1 test/test_subcommand.rb
autobuild-1.10.0.b4 test/test_subcommand.rb
autobuild-1.10.0.b3 test/test_subcommand.rb
autobuild-1.10.0.b2 test/test_subcommand.rb
autobuild-1.9.2 test/test_subcommand.rb
autobuild-1.10.0.b1 test/test_subcommand.rb
autobuild-1.9.1 test/test_subcommand.rb
autobuild-1.9.0 test/test_subcommand.rb
autobuild-1.9.0.b3 test/test_subcommand.rb
autobuild-1.9.0.b2 test/test_subcommand.rb
autobuild-1.9.0.b1 test/test_subcommand.rb