Sha256: 1587c309a2a80ec88807b767778c18bd11c11d616bd1abdcd544955f97c18b7a

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe ExtendIt::Config do
  before do
    @tmp_use_refines = described_class.instance_variable_get(:@use_refines)
    described_class.instance_variable_set(:@use_refines, nil)
  end

  after do
    described_class.instance_variable_set(:@use_refines, @tmp_use_refines)
  end

  describe '::use_refines' do
    it 'sets to false as default' do
      expect(described_class.use_refines).to be_false
    end

    if RUBY_VERSION >= '2.1.0'
      it 'sets value from argument' do
        described_class.use_refines(true)
        expect(described_class.use_refines).to be_true
      end
    else
      it 'avoids of setting true value' do
        expect {
          described_class.use_refines(true)
        }.to raise_error RuntimeError
      end
    end
  end

  describe '::use_refines=' do
    if RUBY_VERSION >= '2.1.0'
      it 'sets value from argument' do
        described_class.use_refines = true
        expect(described_class.use_refines).to be_true
      end
    else
      it 'avoids of setting true value' do
        expect {
          described_class.use_refines = true
        }.to raise_error RuntimeError
      end
    end
  end

  describe '::use_refines?' do
    it 'sets to false as default' do
      expect(described_class.use_refines?).to be_false
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
admin_it-1.0.11 spec/extend_it/config_spec.rb
admin_it-1.0.10 spec/extend_it/config_spec.rb
admin_it-1.0.9 spec/extend_it/config_spec.rb
admin_it-1.0.8 spec/extend_it/config_spec.rb