Sha256: 0fa2b5c9485d72c36d730406fa6b7ff7aa808ead4b31c9db4ed6320df8c95d48

Contents?: true

Size: 676 Bytes

Versions: 1

Compression:

Stored size: 676 Bytes

Contents

require 'spec_helper'

describe Observer, '.coerce' do

  subject { object.coerce(input) }

  let(:object) { described_class }

  context 'with nil input' do
    let(:input) { nil }

    it { should be(described_class::NULL) }
  end

  context 'with array input' do
    let(:input) { ['Spec::Observer', nil] }

    let(:observers) { [Spec::Observer, described_class::NULL] }

    it { should eql(described_class::Chain.new(observers)) }
  end

  context 'with other input' do
    let(:input)   { double }
    let(:coerced) { double }

    before do
      Utils.should_receive(:coerce_callable).with(input).and_return(coerced)
    end

    it { should eql(coerced) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
substation-0.0.10.beta2 spec/unit/substation/observer/class_methods/coerce_spec.rb