Permalink
Browse files

Fix the postgres add_index specs to use #indexes rather than mocks to…

… detect their success, and properly remove the created indices
  • Loading branch information...
1 parent fd09f85 commit d64ac1c03c837d6fffddfac1a0dc0818bf10bce6 @Empact committed Aug 16, 2011
Showing with 6 additions and 7 deletions.
  1. +6 −7 spec/postgresql/connection_adapter_spec.rb
@@ -219,19 +219,18 @@
end
describe "#add_index" do
- after :each do
- @connection.should_receive(:execute).with(any_args())
- @connection.remove_index('geometry_models', 'geom')
- end
-
it "should create a spatial index given :spatial => true" do
- @connection.should_receive(:execute).with(/using gist/i)
@connection.add_index('geometry_models', 'geom', :spatial => true)
+ @connection.indexes('geometry_models').first.spatial.should be_true
+ @connection.indexes('geometry_models').first.columns.should == ['geom']
+ @connection.remove_index('geometry_models', 'geom')
end
it "should not create a spatial index unless specified" do
- @connection.should_not_receive(:execute).with(/using gist/i)
@connection.add_index('geometry_models', 'extra')
+ @connection.indexes('geometry_models').first.spatial.should be_false
+ @connection.indexes('geometry_models').first.columns.should == ['extra']
+ @connection.remove_index('geometry_models', 'extra')
end
end
end

0 comments on commit d64ac1c

Please sign in to comment.