Sha256: 1e5b779ac987515daa0e92e2aee24327d3af40ae9526a8d287c51a0fa7216e8a
Contents?: true
Size: 1003 Bytes
Versions: 1
Compression:
Stored size: 1003 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe Sinclair::MethodDefinition::InstanceMethodDefinition do describe 'yard' do describe '#from' do describe 'using string method with no options' do subject(:method_definition) do described_class.from(name, code) end let(:klass) { Class.new } let(:instance) { klass.new } let(:code) { '@x = @x.to_i ** 2 + 1' } let(:name) { :sequence } it 'adds a dynamic method' do expect { method_definition.build(klass) }.to add_method(name).to(instance) expect(instance.sequence).to eq(1) expect(instance.sequence).to eq(2) expect(instance.sequence).to eq(5) end it 'changes instance variable' do method_definition.build(klass) expect { instance.sequence } .to change { instance.instance_variable_get(:@x) } .from(nil).to 1 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinclair-1.4.2 | spec/integration/yard/sinclair/method_definition/instance_method_definition_spec.rb |