Sha256: df82a2987b3760beb28f587df496bff9e4a4177576eca0f37374fe082c8f53dc

Contents?: true

Size: 839 Bytes

Versions: 3

Compression:

Stored size: 839 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Yardstick, '.measure' do
  let(:string) { double('string') }

  context 'when no arguments' do
    subject { described_class.measure_string(string) }

    it 'delegates to Processor' do
      processor = double('processor')
      Yardstick::Processor.stub(:new).with(instance_of(Yardstick::Config)) do
        processor
      end
      processor.should_receive(:process_string).with(string)
      subject
    end
  end

  context 'when custom config' do
    subject { described_class.measure_string(string, config) }

    let(:config) { double('config') }

    it 'delegates to Processor' do
      processor = double('processor')
      Yardstick::Processor.stub(:new).with(config) { processor }
      processor.should_receive(:process_string).with(string)
      subject
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yardstick-0.9.9 spec/unit/yardstick/class_methods/measure_string_spec.rb
yardstick-0.9.8 spec/unit/yardstick/class_methods/measure_string_spec.rb
yardstick-0.9.7 spec/unit/yardstick/class_methods/measure_string_spec.rb