Sha256: 65afcc58bf7c92f35e5dfb1f2ac32a7d93211c4140f071de9234cd370b95f65b
Contents?: true
Size: 879 Bytes
Versions: 5
Compression:
Stored size: 879 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe Sinclair::ClassMethods do subject(:builder) { builder_class.new(dummy_class, options) } let(:options) { {} } let(:instance) { dummy_class.new } let(:dummy_class) { Class.new } let(:builder_class) { Sinclair } describe '#build' do let(:block) do method_name = :some_method value = 1 proc do add_method(method_name) { value } end end it 'executes the block and builds' do expect { builder_class.build(dummy_class, options, &block) } .to add_method(:some_method).to(dummy_class) end context 'when the method is built and called' do before do builder_class.build(dummy_class, options, &block) end it 'returns the value' do expect(instance.some_method).to eq(1) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems