Sha256: 9ce1a23dbecff2f8831908043c9197dea676dfb0b8046184b06081041ef42502

Contents?: true

Size: 699 Bytes

Versions: 2

Compression:

Stored size: 699 Bytes

Contents

require 'spec_helper'

FakeClass = Class.new do
  def process; end
end

describe Whisperer::Helpers do
  describe '.add_builder' do
    let(:obj) { 'some simple object' }

    let(:faker) {
      instance_double('FakeClass', process: true)
    }

    before(:all) do
      FakeClass.extend(Whisperer::Helpers)
      FakeClass.add_builder(:process)
    end

    before do
      allow(FakeClass).to receive(:new).and_return(faker)
    end

    subject { FakeClass.process(obj) }

    it 'initializes the fake object' do
      expect(FakeClass).to receive(:new).with(obj)

      subject
    end

    it 'serializes an object' do
      expect(faker).to receive(:process)

      subject
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whisperer-0.0.2 spec/unit/helpers_spec.rb
whisperer-0.0.1 spec/unit/helpers_spec.rb