Sha256: 5bb59fd657840534531b8a4e94a93109541b160bdc4713eeb9bb23e2dc6b0f1c

Contents?: true

Size: 1.19 KB

Versions: 16

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe CodeClimate::TestReporter do
  let(:reporter) { CodeClimate::TestReporter.dup }

  describe '.run_on_current_branch?' do
    it 'returns true if there is no branch configured' do
      allow(reporter).to receive(:configured_branch).and_return(nil)
      expect(reporter).to be_run_on_current_branch
    end

    it 'returns true if the current branch matches the configured branch' do
      allow(reporter).to receive(:current_branch).and_return("master\n")
      allow(reporter).to receive(:configured_branch).and_return(:master)

      expect(reporter).to be_run_on_current_branch
    end

    it 'returns false if the current branch and configured branch dont match' do
      allow(reporter).to receive(:current_branch).and_return("some-branch")
      allow(reporter).to receive(:configured_branch).and_return(:master)

      expect(reporter).to_not be_run_on_current_branch
    end

    it 'logs a message if false' do
      expect_any_instance_of(Logger).to receive(:info)

      allow(reporter).to receive(:current_branch).and_return("another-branch")
      allow(reporter).to receive(:configured_branch).and_return(:master)

      reporter.run_on_current_branch?
    end
  end

end

Version data entries

16 entries across 14 versions & 3 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.0/spec/lib/test_reporter_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/codeclimate-test-reporter-0.4.0/spec/lib/test_reporter_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/codeclimate-test-reporter-0.4.0/spec/lib/test_reporter_spec.rb
construi-0.6.0 vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/spec/lib/test_reporter_spec.rb
construi-0.5.0 vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/spec/lib/test_reporter_spec.rb
construi-0.4.0 vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/spec/lib/test_reporter_spec.rb
construi-0.2.0 vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/spec/lib/test_reporter_spec.rb
construi-0.1.0 vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/spec/lib/test_reporter_spec.rb
codeclimate-test-reporter-0.4.7 spec/lib/test_reporter_spec.rb
codeclimate-test-reporter-0.4.6 spec/lib/test_reporter_spec.rb
codeclimate-test-reporter-0.4.5 spec/lib/test_reporter_spec.rb
codeclimate-test-reporter-0.4.4 spec/lib/test_reporter_spec.rb
codeclimate-test-reporter-0.4.3 spec/lib/test_reporter_spec.rb
codeclimate-test-reporter-0.4.2 spec/lib/test_reporter_spec.rb
codeclimate-test-reporter-0.4.1 spec/lib/test_reporter_spec.rb
codeclimate-test-reporter-0.4.0 spec/lib/test_reporter_spec.rb