spec/lib/indexes/index_spec.rb in picky-3.0.0.pre1 vs spec/lib/indexes/index_spec.rb in picky-3.0.0.pre2

- old
+ new

@@ -6,34 +6,40 @@ let(:some_source) { stub :source, :harvest => nil, :inspect => 'some_source' } context 'initializer' do it 'works' do - expect { described_class.new :some_index_name, source: some_source }.to_not raise_error + the_source = some_source + expect { described_class.new :some_index_name do source the_source end }.to_not raise_error end it 'fails correctly' do expect { described_class.new 0, some_source }.to raise_error end it 'fails correctly' do - expect { described_class.new :some_index_name, source: :some_source }.to raise_error - end - it 'fails correctly' do expect { described_class.new :some_index_name, some_source }.to raise_error end it 'does not fail' do - expect { described_class.new :some_index_name, source: [] }.to_not raise_error + expect { described_class.new :some_index_name do source [] end }.to_not raise_error end it 'registers with the indexes' do @api = described_class.allocate Picky::Indexes.should_receive(:register).once.with @api - @api.send :initialize, :some_index_name, source: some_source + the_source = some_source + @api.send :initialize, :some_index_name do + source the_source + end end end context 'unit' do - let(:api) { described_class.new :some_index_name, source: some_source } + let(:api) do + the_source = some_source + described_class.new :some_index_name do + source the_source + end + end describe 'geo_categories' do it 'delegates correctly' do api.should_receive(:ranged_category).once.with :some_lat, 0.00898312, from: :some_lat_from api.should_receive(:ranged_category).once.with :some_lng, 0.01796624, from: :some_lng_from \ No newline at end of file