Sha256: f98c413be0dc15d456c06a9558131cf4dbd896ddb28adbe18244f7bcb7324229

Contents?: true

Size: 843 Bytes

Versions: 28

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Sinclair::Matchers do
  subject(:builder_class) { DefaultValue }

  let(:klass)         { Class.new }
  let(:method)        { :the_method }
  let(:value)         { Random.rand(100) }
  let(:builder)       { builder_class.new(klass, method, value) }
  let(:instance)      { klass.new }

  context 'when the builder runs' do
    it do
      expect { builder.build }.to add_method(method).to(instance)
    end

    it do
      expect { builder.build }.to add_method(method).to(klass)
    end
  end

  context 'when adding class methods' do
    subject(:builder) { builder_class.new(klass, method, value, class_method: true) }

    context 'when the builder runs' do
      it do
        expect { builder.build }.to add_class_method(method).to(klass)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
sinclair-1.6.7 spec/integration/readme/sinclair/matchers_spec.rb
sinclair-1.6.6 spec/integration/readme/sinclair/matchers_spec.rb
sinclair-1.6.5 spec/integration/readme/sinclair/matchers_spec.rb
sinclair-1.6.4 spec/integration/readme/sinclair/matchers_spec.rb
sinclair-1.6.3 spec/integration/readme/sinclair/matchers_spec.rb
sinclair-1.6.2 spec/integration/readme/sinclair/matchers_spec.rb
sinclair-1.6.1 spec/integration/readme/sinclair/matchers_spec.rb
sinclair-1.6.0 spec/integration/readme/sinclair/matchers_spec.rb