aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/log_subscriber_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Set non 0 value to logger not to be affected by Ruby versionsYasuo Honda2017-05-171-23/+23
| | | | Addresses #29021
* Should escape meta characters in regexpRyuta Kamizono2017-05-071-8/+8
|
* Stop creating duplicate Struct instancesJon Moss2017-04-281-23/+15
| | | | | | Just use one `Event` class. Reduces duplication, makes the tests easier to read. It might seem like each tests needs a different kind of Struct, since we make a new one for each test case.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+1
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-4/+4
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-5/+5
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix ActiveRecord::LogSubscriber edge caseJon Moss2016-05-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an attribute was of the binary type, and also was a Hash, it would previously not be logged, and instead raise an error saying that `bytesize` was not defined for the `attribute.value` (a `Hash`). Now, as is done on 4-2-stable, the attribute's database value is `bytesize`d, and then logged out to the terminal. Reproduction script: ```ruby require 'active_record' require 'minitest/autorun' require 'logger' ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Schema.define do create_table :posts, force: true do |t| t.binary :preferences end end class Post < ActiveRecord::Base serialize :preferences end class BugTest < Minitest::Test def test_24955 Post.create!(preferences: {a: 1}) assert_equal 1, Post.count end end ```
* `test_binary_data_is_not_logged` is for prepared statements loggingRyuta Kamizono2015-11-051-1/+1
|
* Improve sql logging coloration in `ActiveRecord::LogSubscriber`.Peter Boling2015-07-171-0/+98
| | | | | | | | | | | | | | | | | | | | | | | - Improves coloring for statements like: # Become WHITE SELECT * FROM ( SELECT * FROM mytable FOR UPDATE ) ss WHERE col1 = 5; LOCK TABLE table_name IN ACCESS EXCLUSIVE MODE; # Becomes RED ROLLBACK - Reinstates the coloration of the `payload[:name]`. Instead of simple alternating colors, adds meaning: - `MAGENTA` for `"SQL"` or `blank?` payload names - `CYAN` for Model Load/Exists - Introduces specs for sql coloration. - Introduces specs for payload name coloration. GH#20885
* Remove Relation#bind_paramsSean Griffin2015-01-271-8/+0
| | | | | | | | `bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
* Stop special casing null binary data in loggingSean Griffin2015-01-101-7/+0
| | | | | | There's very little value in logging "<NULL binary data>" instead of just "nil". I'd like to remove the column from the equation entirely, and this case is preventing us from doing so.
* Fix exception when logging SQL w/ nil binary value.James Coleman2014-05-021-0/+7
|
* Don't skip tests if we don't need to.Rafael Mendonça França2013-11-081-6/+6
| | | | | | | We can conditional define the tests depending on the adapter or connection. Lets keep the skip for fail tests that need to be fixed.
* log the sql that is actually sent to the databaseNeeraj Singh2013-06-191-0/+7
| | | | | | | | | | | | If I have a query that produces sql `WHERE "users"."name" = 'a b'` then in the log all the whitespace is being squeezed. So the sql that is printed in the log is `WHERE "users"."name" = 'a b'`. This can be confusing. This commit fixes it by ensuring that whitespace is not squeezed. fixes #10982
* Ignore binds payload with nil column in AR log subscriberCarlos Antonio da Silva2013-01-081-16/+26
| | | | | | | | | | | | | Some tests were raising the following error: Could not log "sql.active_record" event. NoMethodError: undefined method `type' for nil:NilClass` Due to the way binds were being logged, the column info was considered always present, but that is not true for some of the tests listed in the issue. Closes #8806.
* Address test_binary_data_is_not_logged with Oracle databaseYasuo Honda2012-12-191-2/+1
| | | | | | The number of sql statement logged depends on each database adapter implementation. Also, this test does not depends on how many sql statement executed.
* Skip binary data with binds test for mysql2, fix buildCarlos Antonio da Silva2012-12-141-0/+2
| | | | | | | Mysql2 doesn't support binds, which means no binds payload is set when logging, so the logic to render binary data differently here doesn't work. Introduced in 99d142a9375f9ba1960863b3cc745265aa9a14df.
* Do not log the binding values for binary columns.Matthew M. Boedicker2012-12-141-0/+8
| | | | They tend to be large and not very useful in the log.
* Remove ActiveRecord::Base.to_aJon Leighton2012-08-031-6/+6
| | | | | On reflection, it seems like a bit of a weird method to have on ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-6/+6
| | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
* Remove IdentityMapCarlos Antonio da Silva2012-03-131-12/+0
|
* remove more uses of deprecated logger methodsAaron Patterson2011-12-191-1/+1
|
* Fix broken test_exists_query_logging from the table_exists? changeJon Leighton2011-12-081-0/+1
|
* Log instrumentation name for exists? queriesJon Guymon2011-06-221-0/+8
|
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* Fix failing AR test.José Valim2011-05-021-0/+12
|
* Disable IdentityMap in log tests, it's not important and when running tests ↵Emilio Tagua2011-04-051-0/+3
| | | | | | rake task it logs more messages in the tested buffer. Signed-off-by: José Valim <jose.valim@gmail.com>
* sql logger ignores schema statementsAaron Patterson2011-03-281-0/+27
|
* Move runtime back to the Thread.currentJosé Valim2010-07-261-0/+4
|
* Move runtime back to connection.José Valim2010-07-251-4/+0
|
* Revert the previous three commits.José Valim2010-07-251-0/+4
| | | | | | * AS::Notifications#instrument should not measure anything, it is not its responsibility; * Adding another argument to AS::Notifications#instrument API needs to be properly discussed;
* use a hash to collect optional statistics about the instrumentationAaron Patterson2010-07-251-4/+0
|
* runtime should be properly initialized.José Valim2010-07-251-0/+4
|
* Make use of severity levelsSantiago Pastorino2010-07-201-2/+3
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix a failing test in Railtie and properly define all severity levels in ↵José Valim2010-07-201-4/+2
| | | | MockLogger for LogSubscriber.
* Test added, we shouldn't log sql calls when logger is not on debug? modeSantiago Pastorino2010-07-201-0/+17
|
* mocking out debing? call in the MockLoggerAaron Patterson2010-07-191-0/+2
|
* activerecord tests should inherit from ActiveRecord::TestCaseAaron Patterson2010-07-141-1/+1
|
* Move Rails::LogSubscriber to ActiveSupport::LogSubscriber, allowing ↵José Valim2010-06-241-5/+4
| | | | frameworks like ActiveRecord and ActiveResource to log outsude Rails::Application [#4816 state:resolved]
* assert log output match in case insensitive mode to avoid failure when ↵Raimonds Simanovskis2010-06-041-2/+2
| | | | quoted table name is in uppercase (when using Oracle)
* cleaning up a bunch of parse time warnings in AR [#4186 state:resolved]Aaron Patterson2010-03-151-5/+5
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Somehow this fixes the AR tests when ran with rake. I should probably figure ↵Carl Lerche2010-03-041-1/+1
| | | | out why.
* Fix active_records' log testsCarl Lerche2010-03-021-2/+3
|
* Revert "Fix test load paths for those not using bundler"Carlhuda2010-02-231-4/+1
| | | | | | This reverts commit eec2d301d4ce9df9c71c1a5aa63053eb970b6818. This commit broke tests. You cannot have a file called "bundler" on the load path.
* Merge master.José Valim2010-02-171-1/+4
|
* Rename Rails::Subscriber to Rails::LogSubscriberPrem Sichanugrist2010-02-161-0/+42