diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2013-03-13 07:24:21 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2013-03-13 07:24:21 +0000 |
commit | 3d4d7420ae43a35ae01343ced6d7c685d0b667ee (patch) | |
tree | ba82d3e6fb5e00cbce6f5d1412fbbd620decb999 /activerecord | |
parent | ba910d76509158d531c637c4ab777beb8b20e53d (diff) | |
download | rails-3d4d7420ae43a35ae01343ced6d7c685d0b667ee.tar.gz rails-3d4d7420ae43a35ae01343ced6d7c685d0b667ee.tar.bz2 rails-3d4d7420ae43a35ae01343ced6d7c685d0b667ee.zip |
Fix ar:mysql2 build on Ruby 1.8.7
The `skip` method is a no-op on Ruby 1.8.7 so we still need to
force skip by returning early from each test.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/bind_parameter_test.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb index e399345734..32726e8d8b 100644 --- a/activerecord/test/cases/bind_parameter_test.rb +++ b/activerecord/test/cases/bind_parameter_test.rb @@ -23,8 +23,6 @@ module ActiveRecord @listener = LogListener.new @pk = Topic.columns.find { |c| c.primary } ActiveSupport::Notifications.subscribe('sql.active_record', @listener) - - skip_if_prepared_statement_caching_is_not_supported end def teardown @@ -32,6 +30,8 @@ module ActiveRecord end def test_binds_are_logged + return skip_bind_parameter_test unless supports_statement_cache? + sub = @connection.substitute_at(@pk, 0) binds = [[@pk, 1]] sql = "select * from topics where id = #{sub}" @@ -43,6 +43,8 @@ module ActiveRecord end def test_find_one_uses_binds + return skip_bind_parameter_test unless supports_statement_cache? + Topic.find(1) binds = [[@pk, 1]] message = @listener.calls.find { |args| args[4][:binds] == binds } @@ -50,6 +52,8 @@ module ActiveRecord end def test_logs_bind_vars + return skip_bind_parameter_test unless supports_statement_cache? + pk = Topic.columns.find { |x| x.primary } payload = { @@ -82,8 +86,12 @@ module ActiveRecord private - def skip_if_prepared_statement_caching_is_not_supported - return skip('prepared statement caching is not supported') unless @connection.supports_statement_cache? + def skip_bind_parameter_test + skip('prepared statement caching is not supported') + end + + def supports_statement_cache? + @connection.supports_statement_cache? end end end |