Sha256: 3af831cb336770d43233efe2efb187d68bdedb779de52661ac34984818b3ba24

Contents?: true

Size: 835 Bytes

Versions: 3

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true

describe 'Non-redefineable core methods' do
  specify 'fails when setting key intersects with any internal Qonfig::Settings core method' do
    core_methods = (
      Qonfig::Settings.instance_methods(false) |
      Qonfig::Settings.private_instance_methods(false) |
      %i[define_singleton_method super self]
    )

    expect(core_methods).not_to include(:super_test_key)

    core_methods.each do |core_method|
      expect do
        Class.new(Qonfig::DataSet) do
          setting core_method
        end
      end.to raise_error(Qonfig::CoreMethodIntersectionError)

      expect do
        Class.new(Qonfig::DataSet) do
          setting :super_test_key do
            setting core_method
          end
        end
      end.to raise_error(Qonfig::CoreMethodIntersectionError)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qonfig-0.28.0 spec/features/non_redefineable_core_methods_spec.rb
qonfig-0.27.0 spec/features/non_redefineable_core_methods_spec.rb
qonfig-0.26.0 spec/features/non_redefineable_core_methods_spec.rb