Sha256: cc7ddc8a83d70cc361128ab3b273a0f7fce60ea77710cd642640b9574e8555cd

Contents?: true

Size: 886 Bytes

Versions: 2

Compression:

Stored size: 886 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
  end

  context 'when the builder runs' do
    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

2 entries across 2 versions & 1 rubygems

Version Path
sinclair-1.5.2 spec/integration/readme/sinclair/matchers_spec.rb
sinclair-1.5.1 spec/integration/readme/sinclair/matchers_spec.rb