Sha256: 71c39655346671a80d0304796fdf51150f36c5c23a8d3caa55675bf74f64cf1e

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'
require 'fileutils'

module Beaker
  describe TestSuite do

    context 'new', :use_fakefs => true do
      let(:test_dir) { 'tmp/tests' }

      let(:options)  { {:tests => create_files(@files)} }
      let(:rb_test)  { File.expand_path(test_dir + '/my_ruby_file.rb')    }
      let(:pl_test)  { File.expand_path(test_dir + '/my_perl_file.pl')    }
      let(:sh_test)  { File.expand_path(test_dir + '/my_shell_file.sh')   }

      it 'fails without test files' do
        expect { Beaker::TestSuite.new 'name', 'hosts',
                  Hash.new, 'config', :stop_on_error }.to raise_error
      end

      it 'includes specific files as test file when explicitly passed' do
        @files = [ rb_test ]
        ts = Beaker::TestSuite.new 'name', 'hosts', options,
                                             'config', :stop_on_error

        expect { ts.instance_variable_get(:@test_files).
                  include? rb_test }.to be_true
      end

      it 'includes only .rb files as test files when dir is passed' do
        create_files [ rb_test, pl_test, sh_test ]
        @files = [ test_dir ]

        ts = Beaker::TestSuite.new 'name', 'hosts',
               options, 'config', :stop_on_error

        processed_files = ts.instance_variable_get :@test_files

        expect(processed_files).to include(rb_test)
        expect(processed_files).to_not include(sh_test)
        expect(processed_files).to_not include(pl_test)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beaker-0.0.0 spec/beaker/test_suite_spec.rb