Sha256: 93cde0cbb9ee286519dfd15b5276f853381c7b57ff27ba350250877abb20f0f3

Contents?: true

Size: 952 Bytes

Versions: 5

Compression:

Stored size: 952 Bytes

Contents

require 'spec_helper'

describe EnsureIt do
  describe 'refines requirement' do
    before { @backup = ENSURE_IT_REFINED }

    after do
      if defined? ENSURE_IT_REFINED
        Object.instance_eval { remove_const(:ENSURE_IT_REFINED) }
      end
      ENSURE_IT_REFINED = @backup
    end

    def load_refines
      if defined? ENSURE_IT_REFINED
        Object.instance_eval { remove_const(:ENSURE_IT_REFINED) }
      end
      load(File.expand_path(
        File.join(%w(.. .. .. lib ensure_it_refined.rb)), __FILE__
      ))
    end

    if RUBY_VERSION >= '2.1'
      it 'defines ENSURE_IT_REFINED' do
        load_refines
        expect(ENSURE_IT_REFINED).to be_true
      end
    else
      it %q{warns with ruby < 2.1 and doesn't defines ENSURE_IT_REFINED} do
        expect {
          load_refines
        }.to warn('EsureIt: refines supported only for ruby >= 2.1')
        expect(ENSURE_IT_REFINED).to be_false
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ensure_it-1.0.0 spec/integration/refines_spec.rb
ensure_it-0.1.5 spec/integration/refines_spec.rb
ensure_it-0.1.4 spec/integration/refines_spec.rb
ensure_it-0.1.3 spec/integration/refines_spec.rb
ensure_it-0.1.2 spec/integration/refines_spec.rb