Sha256: 6b169103d0173bf16a83b7b1d867f55c5173c97dcd1bc8689c1fd5a34873df79
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Sinclair::MethodBuilder do subject(:builder) { described_class.new(klass) } let(:klass) { Class.new } let(:definitions) { Sinclair::MethodDefinitions.new } let(:value) { Random.rand } let(:method_name) { :the_method } let(:instance) { klass.new } before do definitions.add(method_name, value.to_s) end describe '#build_methods' do context 'when building an instance method' do let(:type) { described_class::INSTANCE_METHOD } it do expect { builder.build_methods(definitions, type) } .to add_method(method_name).to(instance) end context 'when the method is called' do before { builder.build_methods(definitions, type) } it do expect(instance.the_method).to eq(value) end end end context 'when building a class method' do let(:type) { described_class::INSTANCE_METHOD } it do expect { builder.build_methods(definitions, type) } .to add_method(method_name).to(instance) end context 'when the method is called' do before { builder.build_methods(definitions, type) } it do expect(instance.the_method).to eq(value) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sinclair-1.5.2 | spec/lib/sinclair/method_builder_spec.rb |
sinclair-1.5.1 | spec/lib/sinclair/method_builder_spec.rb |
sinclair-1.5.0 | spec/lib/sinclair/method_builder_spec.rb |