Sha256: abf9fef6b9faaadcc89eeb2cfb569dfb534ab330802be8f9c76e9f42fe3409c1

Contents?: true

Size: 689 Bytes

Versions: 39

Compression:

Stored size: 689 Bytes

Contents

module Contracts
  RSpec.describe Support do
    describe "eigenclass?" do
      it "is falsey for non-singleton classes" do
        expect(Contracts::Support.eigenclass? String).to be_falsey
      end

      it "is truthy for singleton classes" do
        singleton_class = String.instance_exec { class << self; self; end }
        expect(Contracts::Support.eigenclass? singleton_class).to be_truthy
      end
    end

    describe "eigenclass_of" do
      it "returns the eigenclass of a given object" do
        singleton_class = String.instance_exec { class << self; self; end }
        expect(Contracts::Support.eigenclass_of String).to eq singleton_class
      end
    end
  end
end

Version data entries

39 entries across 30 versions & 7 rubygems

Version Path
contracts-0.17.2 spec/support_spec.rb
contracts-0.17.1 spec/support_spec.rb
entitlements-app-1.1.0 lib/contracts-ruby3/spec/support_spec.rb
entitlements-app-1.1.0 lib/contracts-ruby2/spec/support_spec.rb
entitlements-app-1.0.0 lib/contracts-ruby2/spec/support_spec.rb
entitlements-app-1.0.0 lib/contracts-ruby3/spec/support_spec.rb
entitlements-app-0.3.4 lib/contracts-ruby3/spec/support_spec.rb
entitlements-app-0.3.4 lib/contracts-ruby2/spec/support_spec.rb
entitlements-app-0.3.1 lib/contracts-ruby3/spec/support_spec.rb
entitlements-app-0.3.1 lib/contracts-ruby2/spec/support_spec.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/contracts-0.17/spec/support_spec.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/contracts-0.17/spec/support_spec.rb
entitlements-app-0.3.0 lib/contracts-ruby3/spec/support_spec.rb
entitlements-app-0.3.0 lib/contracts-ruby2/spec/support_spec.rb
entitlements-0.2.1 lib/contracts-ruby3/spec/support_spec.rb
entitlements-0.2.1 lib/contracts-ruby2/spec/support_spec.rb
entitlements-app-0.2.1 lib/contracts-ruby2/spec/support_spec.rb
entitlements-app-0.2.1 lib/contracts-ruby3/spec/support_spec.rb
entitlements-0.2.0 lib/contracts-ruby2/spec/support_spec.rb
entitlements-0.2.0 lib/contracts-ruby3/spec/support_spec.rb