Sha256: 99acccf3171f2a23496e78d13cfb4f266dd07efc22cef80416fe0413878bb9fb

Contents?: true

Size: 934 Bytes

Versions: 29

Compression:

Stored size: 934 Bytes

Contents

require 'spec_helper'

describe Picky::Backends::Backend do

  context 'without options' 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

end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
picky-3.6.16 spec/lib/backends/backend_spec.rb
picky-3.6.15 spec/lib/backends/backend_spec.rb
picky-3.6.14 spec/lib/backends/backend_spec.rb
picky-3.6.13 spec/lib/backends/backend_spec.rb
picky-3.6.12 spec/lib/backends/backend_spec.rb
picky-3.6.11 spec/lib/backends/backend_spec.rb
picky-3.6.10 spec/lib/backends/backend_spec.rb
picky-3.6.9 spec/lib/backends/backend_spec.rb
picky-3.6.8 spec/lib/backends/backend_spec.rb
picky-3.6.7 spec/lib/backends/backend_spec.rb
picky-3.6.6 spec/lib/backends/backend_spec.rb
picky-3.6.4 spec/lib/backends/backend_spec.rb
picky-3.6.3 spec/lib/backends/backend_spec.rb
picky-3.6.2 spec/lib/backends/backend_spec.rb
picky-3.6.1 spec/lib/backends/backend_spec.rb
picky-3.6.0 spec/lib/backends/backend_spec.rb
picky-3.5.4 spec/lib/backends/backend_spec.rb
picky-3.5.3 spec/lib/backends/backend_spec.rb
picky-3.5.2 spec/lib/backends/backend_spec.rb
picky-3.5.1 spec/lib/backends/backend_spec.rb