Permalink
Browse files

Merge pull request #23 from pyromaniac/pg_improvements

Added interpolation spec, try to fix travis
  • Loading branch information...
2 parents 423bc58 + f8016e2 commit e718f9783954ab16adc90e12213911b04e030afd @jashmenn committed Jan 30, 2013
View
@@ -5,31 +5,23 @@ before_script:
rvm:
- 1.9.2
- 1.9.3
- #- ruby-head
- #- rbx-19mode
+ - 2.0.0
+ - rbx-19mode
+
+gemfile:
+ - Gemfile
+ - gemfiles/Gemfile.rails-3-1
+ - gemfiles/Gemfile.rails-3-2
+ - gemfiles/Gemfile.rails-head
env:
- - ACTIVERECORD_VERSION='~>3.1.0'
- - ACTIVERECORD_VERSION='~>3.1.0' DB=mysql
- - ACTIVERECORD_VERSION='~>3.1.0' DB=postgresql
- - ACTIVERECORD_VERSION='~>3.2.0'
- - ACTIVERECORD_VERSION='~>3.2.0' DB=mysql
- - ACTIVERECORD_VERSION='~>3.2.0' DB=postgresql
- - ACTIVERECORD_VERSION=3-1-stable
- - ACTIVERECORD_VERSION=3-1-stable DB=mysql
- - ACTIVERECORD_VERSION=3-1-stable DB=postgresql
- - ACTIVERECORD_VERSION=3-2-stable
- - ACTIVERECORD_VERSION=3-2-stable DB=mysql
- - ACTIVERECORD_VERSION=3-2-stable DB=postgresql
- - ACTIVERECORD_VERSION=master
- - ACTIVERECORD_VERSION=master DB=mysql
- - ACTIVERECORD_VERSION=master DB=postgresql
+ - DB=sqlite3
+ - DB=mysql
+ - DB=postgresql
matrix:
+ allow_failures:
+ - gemfile: gemfiles/Gemfile.rails-head
exclude:
- rvm: 1.9.2
- env: ACTIVERECORD_VERSION=master
- - rvm: 1.9.2
- env: ACTIVERECORD_VERSION=master DB=mysql
- - rvm: 1.9.2
- env: ACTIVERECORD_VERSION=master DB=postgresql
+ gemfile: gemfiles/Gemfile.rails-head
View
@@ -3,13 +3,4 @@ source "http://rubygems.org"
# Specify your gem's dependencies in activeuuid.gemspec
gemspec
-case version = ENV['ACTIVERECORD_VERSION'] || '~> 3.2'
-when /master/
- gem "activerecord", :github => "rails/rails"
-when /3-1-stable/
- gem "activerecord", :github => "rails/rails", :branch => "3-1-stable"
-when /3-2-stable/
- gem "activerecord", :github => "rails/rails", :branch => "3-2-stable"
-else
- gem "activerecord", version
-end
+gem "activerecord"
View
@@ -4,3 +4,5 @@ require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
+
+task :default => :spec
@@ -0,0 +1,5 @@
+source "http://rubygems.org"
+
+gemspec path: '../'
+
+gem 'activerecord', '~> 3.1.0'
@@ -0,0 +1,5 @@
+source "http://rubygems.org"
+
+gemspec path: '../'
+
+gem 'activerecord', '~> 3.2.0'
@@ -0,0 +1,5 @@
+source "http://rubygems.org"
+
+gemspec path: '../'
+
+gem 'activerecord', github: 'rails/rails'
@@ -81,18 +81,14 @@ module PostgreSQLQuoting
included do
def quote_with_visiting(value, column = nil)
- if column && column.type == :uuid
- value = UUIDTools::UUID.serialize(value)
- value = value.to_s if value.is_a? UUIDTools::UUID
- end
+ value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid
+ value = value.to_s if value.is_a? UUIDTools::UUID
quote_without_visiting(value, column)
end
def type_cast_with_visiting(value, column = nil)
- if column && column.type == :uuid
- value = UUIDTools::UUID.serialize(value)
- value = value.to_s if value.is_a? UUIDTools::UUID
- end
+ value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid
+ value = value.to_s if value.is_a? UUIDTools::UUID
type_cast_without_visiting(value, column)
end
@@ -107,6 +107,15 @@
its(:id) { should be_a UUIDTools::UUID }
end
+ context 'interpolation' do
+ specify { model.where("id = :id", id: article.id) }
+ end
+
+ context 'batch interpolation' do
+ before { model.update_all(["title = CASE WHEN id = :id THEN 'Passed' ELSE 'Nothing' END", id: article.id]) }
+ specify { article.reload.title.should == 'Passed' }
+ end
+
context '.find' do
specify { model.find(article).should == article }
specify { model.find(id).should == article }
@@ -3,7 +3,7 @@ sqlite3:
database: ":memory:"
postgresql:
adapter: postgresql
- username: postgres
+ host: localhost
database: activeuuid_test
mysql:
adapter: mysql2

0 comments on commit e718f97

Please sign in to comment.