Sha256: 53f8fba1ae1bc54e7917720cd00841172006d8c8ce4c0aab17cf4ea960acd041
Contents?: true
Size: 1.28 KB
Versions: 11
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Sinclair::MethodDefinitions do subject(:definitions) { described_class.new } describe '#add' do let(:name) { :the_method } context 'when passing block' do it 'returns the resulting array' do expect(definitions.add(name) { RandomGenerator.rand }) .to be_a(Array) end it 'returns an array of MethodDefinition' do expect(definitions.add(name) { RandomGenerator.rand }.first) .to be_a(Sinclair::MethodDefinition) end it 'creates a new BlockDefinition' do expect(definitions.add(name) { RandomGenerator.rand }.first) .to be_a(Sinclair::MethodDefinition::BlockDefinition) end end context 'when passing string' do it 'returns the resulting array' do expect(definitions.add(name, 'RandomGenerator.rand')) .to be_a(Array) end it 'returns an array of MethodDefinition' do expect(definitions.add(name, 'RandomGenerator.rand').last) .to be_a(Sinclair::MethodDefinition) end it 'creates a new StringDefinition' do expect(definitions.add(name, 'RandomGenerator.rand').last) .to be_a(Sinclair::MethodDefinition::StringDefinition) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems