mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
CreateTable supports all PG-specific columns even under Rails 4.0
Successive versions of Rails provided explicit support for more column types such as `money` and `uuid`. However, the ability to create a Postgres table with one of these column type is really dependent on which Postgres version you're using, and not which Rails version you're using -- all you have to do is use `t.column` rather than e.g., `t.money`, `t.uuid`, etc.
This commit is contained in:
parent
a559713f96
commit
d9a887b905
2 changed files with 1 additions and 10 deletions
|
@ -47,14 +47,7 @@ module UnitTests
|
|||
column_options = {}
|
||||
end
|
||||
|
||||
begin
|
||||
table.__send__(column_type, column_name, column_options)
|
||||
rescue NoMethodError
|
||||
raise ColumnNotSupportedError.new(
|
||||
"#{Tests::Database.instance.adapter_class} does not support " +
|
||||
":#{column_type} columns."
|
||||
)
|
||||
end
|
||||
table.column(column_name, column_type, column_options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -72,8 +72,6 @@ module UnitTests
|
|||
def whitelist_attributes?
|
||||
options.fetch(:whitelist_attributes, true)
|
||||
end
|
||||
|
||||
ColumnNotSupportedError = Class.new(StandardError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue