Sha256: 112bbeb1e81641439ccbab127f965509b28e76b600402f79f8e82b85e092e20b

Contents?: true

Size: 672 Bytes

Versions: 8

Compression:

Stored size: 672 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)   { mock }
    let(:coerced) { mock }

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

    it { should eql(coerced) }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
substation-0.0.8 spec/unit/substation/observer/class_methods/coerce_spec.rb
substation-0.0.7 spec/unit/substation/observer/class_methods/coerce_spec.rb
substation-0.0.6 spec/unit/substation/observer/class_methods/coerce_spec.rb
substation-0.0.5 spec/unit/substation/observer/class_methods/coerce_spec.rb
substation-0.0.4 spec/unit/substation/observer/class_methods/coerce_spec.rb
substation-0.0.3 spec/unit/substation/observer/class_methods/coerce_spec.rb
substation-0.0.2 spec/unit/substation/observer/class_methods/coerce_spec.rb
substation-0.0.1 spec/unit/substation/observer/class_methods/coerce_spec.rb