Sha256: 5dda769a606134a5f73c06edd4cc8a4140cd72c40d1bfe6c9c0f299c1dbcb593
Contents?: true
Size: 905 Bytes
Versions: 1
Compression:
Stored size: 905 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe Sinclair::MethodDefinition::ClassBlockDefinition do describe 'yard' do describe '#build' do subject(:method_definition) do described_class.new(name) do @x = @x.to_i**2 + 1 end end let(:klass) { Class.new } let(:name) { :sequence } it 'adds a dynamic method' do expect { method_definition.build(klass) }.to add_class_method(name).to(klass) expect { klass.sequence } .to change { klass.instance_variable_get(:@x) }.from(nil).to 1 expect(klass.sequence).to eq(2) expect(klass.sequence).to eq(5) end it 'changes instance variable' do method_definition.build(klass) expect { klass.sequence } .to change { klass.instance_variable_get(:@x) } .from(nil).to 1 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/class_block_definition_spec.rb |