Sha256: 6ce18356bbd987fc04aa119d0ab5dd807e439ff2c80ea42d91440e1bb90a9127

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 Bytes

Contents

require 'spec_helper'

describe Picky::Backends::Backend do

  let(:backend) { described_class.new }

  describe 'extract_lambda_or' do
    it 'returns a given non-lambda' do
      backend.extract_lambda_or(:thing).should == :thing
    end
    it 'calls a given lambda with the given args' do
      lam = ->() do
        :lam
      end

      backend.extract_lambda_or(lam).should == :lam
    end
    it 'calls a given lambda with the given args' do
      lam = ->(arg1) do
        arg1.should == 1
        :lam
      end

      backend.extract_lambda_or(lam, 1).should == :lam
    end
    it 'calls a given lambda with the given args' do
      lam = ->(arg1, arg2) do
        arg1.should == 1
        arg2.should == 2
        :lam
      end

      backend.extract_lambda_or(lam, 1, 2).should == :lam
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
picky-4.0.0pre2 spec/lib/backends/backend_spec.rb
picky-4.0.0pre1 spec/lib/backends/backend_spec.rb