Sha256: bf3cad985377041285f02b24df05293f5986e8c8adf16859e403b28c4b65db8b

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

require 'cukeforker/rake_task'

describe CukeForker::RakeTask do
  describe 'define task' do
    it 'creates a cukeforker task' do
      CukeForker::RakeTask.new

      expect(Rake::Task.task_defined?(:cukeforker)).to be true
    end

    it 'creates a named task' do
      CukeForker::RakeTask.new(:run_feature)

      expect(Rake::Task.task_defined?(:run_feature)).to be true
    end
  end

  describe 'running task' do
    before(:each) do
      Rake::Task['cukeforker'].clear if Rake::Task.task_defined?('cukeforker')
    end

    it 'runs specific features' do
      CukeForker::RakeTask.new do |task|
        task.features = ['file1, file2']
        task.verbose = false
      end

      expect(CukeForker::Runner).to receive(:run).and_return(true)

      Rake::Task['cukeforker'].execute
    end

    it 'exits with a non zero status if any tests fail' do
      CukeForker::RakeTask.new do |task|
        task.features = ['file1, file2']
        task.verbose = false
      end

      expect(CukeForker::Runner).to receive(:run).and_return(false)

      expect { Rake::Task['cukeforker'].execute }.to raise_error(Exception)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cukeforker-2.1.1 spec/cukeforker/rake_task_spec.rb
cukeforker-1.1.0 spec/cukeforker/rake_task_spec.rb
cukeforker-1.0.0 spec/cukeforker/rake_task_spec.rb
cukeforker-0.2.5 spec/cukeforker/rake_task_spec.rb