Sha256: 522119ea4cc557d125a93f3898535032afc4aac78dbb9bc33566af074586809f

Contents?: true

Size: 522 Bytes

Versions: 4

Compression:

Stored size: 522 Bytes

Contents

require_relative "spec_helper"

describe Object, ".static_facade" do
  it "creates a class method that instantiates and runs that instance method" do
    klass = Class.new do
      static_facade :fooable?,
        :foo

      def fooable?
        foo
      end
    end

    assert klass.fooable?(true)
    refute klass.fooable?(false)
  end

  it "doesn't require attributes" do
    klass = Class.new do
      static_facade :fooable?

      def fooable?
        true
      end
    end

    assert klass.fooable?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
attr_extras-4.3.0 spec/static_facade_spec.rb
attr_extras-4.2.0 spec/static_facade_spec.rb
attr_extras-4.1.0 spec/static_facade_spec.rb
attr_extras-4.0.0 spec/static_facade_spec.rb