Sha256: 021c1f66b4a2dc7a733fdad8acf63675fdcc566bf0ad132cdebb4a671f340535

Contents?: true

Size: 992 Bytes

Versions: 7

Compression:

Stored size: 992 Bytes

Contents

# frozen_string_literal: true
require 'test_helper'
require 'rubycritic/source_control_systems/base'

describe RubyCritic::SourceControlSystem::Base do
  before do
    RubyCritic::SourceControlSystem::Base.systems.each do |system|
      system.stubs(:supported?).returns(false)
    end
  end

  describe '::create' do
    context 'when a source control system is found' do
      it 'creates an instance of that source control system' do
        RubyCritic::SourceControlSystem::Git.stubs(:supported?).returns(true)
        system = RubyCritic::SourceControlSystem::Base.create
        system.must_be_instance_of RubyCritic::SourceControlSystem::Git
      end
    end

    context 'when no source control system is found' do
      it 'creates a source control system double' do
        capture_output_streams do
          system = RubyCritic::SourceControlSystem::Base.create
          system.must_be_instance_of RubyCritic::SourceControlSystem::Double
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubycritic-3.2.0 test/lib/rubycritic/source_control_systems/base_test.rb
rubycritic-3.1.3 test/lib/rubycritic/source_control_systems/base_test.rb
rubycritic-3.1.2 test/lib/rubycritic/source_control_systems/base_test.rb
rubycritic-3.1.1 test/lib/rubycritic/source_control_systems/base_test.rb
rubycritic-3.1.0 test/lib/rubycritic/source_control_systems/base_test.rb
rubycritic-3.0.0 test/lib/rubycritic/source_control_systems/base_test.rb
rubycritic-2.9.4 test/lib/rubycritic/source_control_systems/base_test.rb