spec/lib/backends/backend_spec.rb in picky-4.0.0pre2 vs spec/lib/backends/backend_spec.rb in picky-4.0.0pre3

- old
+ new

@@ -2,36 +2,52 @@ 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 + describe 'weight' do + it 'delegates to the parameter' do + combinations = stub :combinations - 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 + combinations.should_receive(:score).once.with() - backend.extract_lambda_or(lam, 1).should == :lam + backend.weight combinations end - it 'calls a given lambda with the given args' do - lam = ->(arg1, arg2) do - arg1.should == 1 - arg2.should == 2 - :lam - end + end - backend.extract_lambda_or(lam, 1, 2).should == :lam + describe 'to_s' do + it 'is correct' do + backend.to_s.should == 'Picky::Backends::Backend' end end + + # 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 \ No newline at end of file