can't convert Symbol into Integer when using rgeo, postgis for "have_db_column" shoulda matcher (in rails) #159

Closed
fourcolors opened this Issue Mar 7, 2011 · 2 comments

Comments

Projects
None yet
2 participants

Hi

This is more of an shoulda-matcher issue but I didn't know where I should post this.

I'm using postgis, postgresql and rgeo to draw a route that is datatype of line_string with options geographic. When I run it though the shoulda matche I get

can't convert Symbol into Integer

Here is the matcher and migration that causes the issue. I think shoulda matchers should be able to handle this.

Migration

  #Geographic data that is the route
  t.line_string :route, :geographic => true

rspec test with shoulda matcher

it {should have_db_column(:route).of_type(:line_string).with_options(:geographic)}

They migrations run fine and everything else is in order, the test just doesn't pass. Anyway, I thought I would post this so it could be fixed or maybe added for feature update for shoulda. I guess a work around would be to make my own custom matcher but it would be nice if this was handled by default.

Owner

jferris commented Mar 7, 2011

The with_options method there expects a hash, and you're giving it a symbol. The matcher also only accepts the options precision, limit, default, null, and scale. If you can write a good patch that will support generic options like "geographic," I'd pull it in.

looks like it's a bad idea to test migrations lol. so.. i just deleted those migrations.

fourcolors closed this Mar 23, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment