Sha256: a0f39810bd4e45362abee3bf1897a9ecf8bd46776de2ba180cef062581123bb7

Contents?: true

Size: 694 Bytes

Versions: 5

Compression:

Stored size: 694 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Utils, '.coerce_callable' do

  subject { described_class.coerce_callable(handler) }

  context "with a String handler" do
    let(:handler) { 'Spec::Action::Success' }

    it { should be(Spec::Action::Success) }
  end

  context "with a Symbol handler" do
    let(:handler) { :'Spec::Action::Success' }

    it { should be(Spec::Action::Success) }
  end

  context "with a Proc handler" do
    let(:handler) { Proc.new { |response| respone } }

    it { should be(handler) }
  end

  context "with an unsupported handler" do
    let(:handler) { mock }

    specify do
      expect { subject }.to raise_error(ArgumentError)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
substation-0.0.5 spec/unit/substation/utils/class_methods/coerce_callable_spec.rb
substation-0.0.4 spec/unit/substation/utils/class_methods/coerce_callable_spec.rb
substation-0.0.3 spec/unit/substation/utils/class_methods/coerce_callable_spec.rb
substation-0.0.2 spec/unit/substation/utils/class_methods/coerce_callable_spec.rb
substation-0.0.1 spec/unit/substation/utils/class_methods/coerce_callable_spec.rb