spec/runner_spec.rb in scripterator-1.2.0 vs spec/runner_spec.rb in scripterator-1.3.0
- old
+ new
@@ -8,10 +8,11 @@
let(:awesome_script) do
Proc.new do
before { Widget.before_stuff }
for_each_widget { |widget| Widget.transform_a_widget(widget) }
+ after_batch { |batch| Widget.after_batch_stuff(batch) }
end
end
subject { runner.run(options) }
@@ -29,10 +30,11 @@
let(:awesome_script) do
Proc.new do
model { Widget.where(name: 'bla') }
before { Widget.before_stuff }
for_each_widget { |widget| Widget.transform_a_widget(widget) }
+ after_batch { |batch| Widget.after_batch_stuff(batch) }
end
end
let!(:widget1) { Widget.create(name: 'foo') }
let!(:widget2) { Widget.create(name: 'bla') }
@@ -94,9 +96,10 @@
before { num_widgets.times { Widget.create! } }
it 'runs the given script blocks' do
Widget.should_receive :before_stuff
Widget.should_receive(:transform_a_widget).exactly(num_widgets).times
+ Widget.should_receive :after_batch_stuff
subject
end
context 'when not all records are checked' do
let(:start_id) { Widget.last.id }