Sha256: 5b039b603006ef29a7232a6482d5fca210033edbb02e2f5df90adbb444d5a711

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

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

module Danger
  describe Danger::DangerMcBrain do
    it 'should be a plugin' do
      expect(Danger::DangerMcBrain.new(nil)).to be_a Danger::Plugin
    end

    #
    # You should test your custom attributes and methods here
    #
    describe 'with Dangerfile' do
      before do
        @dangerfile = testing_dangerfile
        @brain = @dangerfile.brain
      end

      it 'should default to a nil namespace' do
        expect(@brain.namespace).to be_nil
      end

      it 'should not use a namespace when it is nil' do
        @brain.namespace = ''
        expect(@brain.send(:real_key, 'asdf')).to eql('asdf')
      end

      it 'should not use a namespace when it is an empty string' do
        @brain.namespace = ''
        expect(@brain.send(:real_key, 'asdf')).to eql('asdf')
      end

      it 'should use namespace as a prefix when available' do
        @brain.namespace = 'pants'
        expect(@brain.send(:real_key, 'asdf')).to eql('pants:asdf')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danger-mcbrain-0.0.2 spec/mcbrain_spec.rb
danger-mcbrain-0.0.1 spec/mcbrain_spec.rb