Sha256: ad845ac6f47ae7289e0c12196f165a433f648c9b2377e7e182ff247e442fe814
Contents?: true
Size: 497 Bytes
Versions: 10
Compression:
Stored size: 497 Bytes
Contents
# frozen_string_literal: false require 'spec_helper' describe Sinclair::ClassMethods do describe 'yard for .build' do before { allow(Random).to receive(:rand).and_return(803) } it 'Simple usage' do model_class = Class.new Sinclair.build(model_class) do add_method(:random_name, cached: true) do "John #{Random.rand(1000)} Doe" end end model = model_class.new expect(model.random_name).to eq('John 803 Doe') end end end
Version data entries
10 entries across 10 versions & 1 rubygems