Sha256: 231d1fc3b80888c6cff88b0ab5a84d1ff4998022ae56a54bbf40492804e6213b

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

describe Method do
  describe '#compose' do
    subject { "aaa".method(:+) }

    it_should_behave_like 'composable' do
      let(:x) { "foo" }
    end
  end

  describe '#with_args' do
    subject { "foobarbaz".method(:delete) }

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

  describe '#flip' do
    context 'arity = 1' do
      subject { "aaa".method(:+) }

      it_should_behave_like 'flip(arity=1)' do
        let(:x) { "foo" }
        let(:y) { "bar" }
      end
    end

    context 'arity > 1' do
      subject { "foobarbaz".method(:tr) }

      it_should_behave_like 'flip' do
        let(:x) { 'r' }
        let(:y) { 'o' }
      end
    end

    context 'varargs' do
      subject { "foobarbaz".method(:delete) }

      it_should_behave_like 'flip(varargs)' do
        let(:x) { 'r' }
        let(:y) { 'o' }
      end
    end
  end

  describe '#curry' do
    context 'arity > 1' do
      subject { "foobarbaz".method(:tr) }

      it_should_behave_like 'curry' do
        let(:x) { 'r' }
        let(:y) { 'o' }
      end
    end

    context 'varargs' do
      subject { "foobarbaz".method(:delete) }

      it_should_behave_like 'curry(varargs)' do
        let(:x) { 'r' }
        let(:y) { 'o' }
      end
    end
  end

  describe '#call' do
    subject { "aaa".method(:+) }

    it_should_behave_like 'call' do
      let(:x) { "foo" }
    end
  end

  describe 'ailases' do
    it_should_behave_like 'aliases' do
      subject { "aaa".method(:+) }
      let(:x) { "foo" }
    end

    it_should_behave_like 'aliases(varargs)' do
      subject { "foobarbaz".method(:delete) }
      let(:x) { 'r' }
      let(:y) { 'o' }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lambda_driver-1.2.0 spec/method_spec.rb
lambda_driver-1.1.2 spec/method_spec.rb
lambda_driver-1.1.1 spec/method_spec.rb
lambda_driver-1.1.0 spec/method_spec.rb
lambda_driver-1.0.0 spec/method_spec.rb