Sha256: 34dca86e6a0f53086ec264bcd214d8f78ea1f36c065a9d794e99ae0fd2f43030

Contents?: true

Size: 1.73 KB

Versions: 5

Compression:

Stored size: 1.73 KB

Contents

require 'spec'
require 'bolt/runners/test_unit'

describe Bolt::Runners::TestUnit do
  
  before(:all) do
    @runner = described_class.new
  end
  
  it 'should translate controllers' do
    @runner.stub('file_verified?').and_return(true)
    @runner.translate('app/controllers/test_controller.rb').should == ['test/functional/test_controller_test.rb']
  end
  
  it 'should translate models' do
    @runner.stub('file_verified?').and_return(true)
    @runner.translate('app/models/test.rb').should == ['test/unit/test_test.rb']
  end
  
  it 'should translate views' do
    @runner.stub('file_verified?').and_return(true)
    @runner.translate('app/views/test/test.html.erb').should == ['test/functional/test_controller_test.rb']
  end
  
  it 'should translate lib' do
    @runner.stub('file_verified?').and_return(true)
    @runner.translate('lib/test.rb').should == ['test/unit/test_test.rb']
  end
  
  it 'should translate lib with subfolders' do
    @runner.stub('file_verified?').and_return(true)
    @runner.translate('lib/testing/test.rb').should == ['test/unit/testing/test_test.rb']
  end
  
  it 'should translate tests to itself' do
    @runner.stub('file_verified?').and_return(true)
    @runner.translate('test/functional/test_controller_test.rb').should == ['test/functional/test_controller_test.rb']
    @runner.translate('test/unit/test_test.rb').should == ['test/unit/test_test.rb']
    @runner.translate('test/unit/testing/test_test.rb').should == ['test/unit/testing/test_test.rb']
  end
  
  it 'should return no results if file is not present' do
     b = StringIO.new
      $stdout, old = b, $stdout
    @runner.stub('file_verified?').and_return(false)
    @runner.translate('lib/testing/test.rb').should == []
    $stdout = old
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
marcinbunsch-bolt-0.1.10 spec/bolt/runners/test_unit_spec.rb
marcinbunsch-bolt-0.2.0 spec/bolt/runners/test_unit_spec.rb
marcinbunsch-bolt-0.2.1 spec/bolt/runners/test_unit_spec.rb
marcinbunsch-bolt-0.2.2 spec/bolt/runners/test_unit_spec.rb
marcinbunsch-bolt-0.2.3 spec/bolt/runners/test_unit_spec.rb