Sha256: 101f4b5888b6cc337b373b0b45085b9d883c4c87e894f5d5dff6eea7fcea3a89

Contents?: true

Size: 1.75 KB

Versions: 2

Compression:

Stored size: 1.75 KB

Contents

require 'spec_helper'

describe Symbol do
  describe '#compose' do
    subject { :to_s }

    it_should_behave_like 'composable'
  end

  describe '#with_args' do
    subject {:delete }

    it_should_behave_like 'with_args' do
      let(:x) { 'foobar' }
      let(:y) { 'o'  }
      let(:z) { 'a'}
    end
  end

  describe '#flip' do
    context 'arity = 1' do
      subject { :to_s }

      it_should_behave_like 'flip(arity=1)'
    end

    context 'varargs' do
      subject {:product }

      it_should_behave_like 'flip(varargs)' do
        let(:x) { [:bar] }
        let(:y) { [:foo] }
      end
    end
  end

  describe '#curry' do
    subject { :product }

    it_should_behave_like 'curry(varargs)' do
      let(:x) { [:bar] }
      let(:y) { [:foo] }
    end
  end

  describe '#call' do
    subject { :to_s }

    it_should_behave_like 'call'
  end

  describe 'ailases' do
    subject { :to_s }

    it_should_behave_like 'aliases'

    it_should_behave_like 'aliases(varargs)' do
      subject { :delete}
      let(:x) { :bar }
      let(:y) { 'a' }
    end
  end

  describe '#to_method' do
    subject { :index.to_method }

    let(:obj) { "foobarbaz" }

    it { should be_a_kind_of Proc }
    it('symbol.to_method.call(obj) should returns Method'){
      subject.call(obj).should be_a_kind_of Method
    }

    it('symbol.to_method.call(obj).call(x) should be obj.method(symbol).call(x)'){
      subject.call(obj).call("bar").should == obj.method(:index).call("bar")
    }

    it('-:symbol.to_method.call(obj) should returns Method'){
      (-:index).call(obj).should be_a_kind_of Method
    }

    it('-:symbol.to_method.call(obj).call(x) should be obj.method(symbol).call(x)'){
      (-:index).call(obj).call("bar").should == obj.method(:index).call("bar")
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lambda_driver-1.1.1 spec/symbol_spec.rb
lambda_driver-1.1.0 spec/symbol_spec.rb