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

Version Path
sinclair-2.1.1 spec/integration/yard/sinclair/class_methods/build_spec.rb
sinclair-2.1.0 spec/integration/yard/sinclair/class_methods/build_spec.rb
sinclair-2.0.1 spec/integration/yard/sinclair/class_methods/build_spec.rb
sinclair-2.0.0 spec/integration/yard/sinclair/class_methods/build_spec.rb
sinclair-1.16.3 spec/integration/yard/sinclair/class_methods/build_spec.rb
sinclair-1.16.2 spec/integration/yard/sinclair/class_methods/build_spec.rb
sinclair-1.16.1 spec/integration/yard/sinclair/class_methods/build_spec.rb
sinclair-1.16.0 spec/integration/yard/sinclair/class_methods/build_spec.rb
sinclair-1.15.0 spec/integration/yard/sinclair/class_methods/build_spec.rb
sinclair-1.14.2 spec/integration/yard/sinclair/class_methods/build_spec.rb