Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
test yielding in SalesforceBulk::Batch
Browse files Browse the repository at this point in the history
  • Loading branch information
Leif Gensert committed Apr 22, 2013
1 parent 771a3d5 commit 7bc70ef
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/lib/salesforce_bulk/batch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
expect(b.final_status).to eq({w: :tf, results: {g: :tfo}})
end

it 'should yield status correctly' do
expected_running_state = {
state: 'InProgress'
}
expected_final_state = {
state: 'Completed'
}
b = described_class.new nil, nil, nil
b.should_receive(:status).once.and_return(expected_running_state)
b.should_receive(:status).once.and_return(expected_running_state)
b.should_receive(:status).once.and_return(expected_final_state)
b.should_receive(:results).once.and_return({g: :tfo})
expect{|blk| b.final_status(0, &blk)}.
to yield_successive_args(expected_running_state, expected_final_state)
end

it 'should raise exception when batch fails' do
b = described_class.new nil, nil, nil
expected_error_message = 'Generic Error Message'
Expand Down

0 comments on commit 7bc70ef

Please sign in to comment.