spec/unit/ogr/data_source_spec.rb in ffi-gdal-1.0.0.beta5 vs spec/unit/ogr/data_source_spec.rb in ffi-gdal-1.0.0.beta6
- old
+ new
@@ -9,9 +9,21 @@
expect do
described_class.open('blarg', 'r')
end.to raise_exception OGR::OpenFailure
end
end
+
+ context 'block given' do
+ let(:data_source) { instance_double 'OGR::DataSource' }
+
+ it 'yields then closes the opened DataSource' do
+ allow(described_class).to receive(:new).and_return data_source
+
+ expect(data_source).to receive(:close)
+ expect { |b| described_class.open('blarg', 'r', &b) }.
+ to yield_with_args(data_source)
+ end
+ end
end
let(:driver) { OGR::Driver.by_name 'Memory' }
subject(:data_source) do