Skip to content

rails4: pull request #173 introduces 3 failures at oracle_enhanced_dbms_output_spec.rb #179

Closed
yahonda opened this Issue Jun 6, 2012 · 5 comments

2 participants

@yahonda
Collaborator
yahonda commented Jun 6, 2012

The pull request #173 introduces 3 failures at oracle_enhanced_dbms_output_spec.rb

$ rspec ./spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb
==> Running specs with MRI version 1.9.3
==> Running specs with Rails version 4.0-master
FFF

Failures:

  1) OracleEnhancedAdapter logging dbms_output from plsql should NOT log dbms output when dbms output is disabled
     Failure/Error: @conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").should == [{'is_it_long'=>1}]
       expected: [{"is_it_long"=>1}]
            got: #<ActiveRecord::Result:0x00000003c32230 @columns=["is_it_long"], @rows=[[1]], @hash_rows=nil, @column_types={}> (using ==)
       Diff:
       @@ -1,2 +1,6 @@
       -[{"is_it_long"=>1}]
       +#<ActiveRecord::Result:0x00000003c32230
       + @column_types={},
       + @columns=["is_it_long"],
       + @hash_rows=[{"is_it_long"=>1}],
       + @rows=[[1]]>
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/expectations/fail_with.rb:33:in `fail_with'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:47:in `fail_with_message'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:69:in `__delegate_operator'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:59:in `eval_match'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:28:in `block in use_custom_matcher_or_delegate'
     # ./spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb:45:in `block (2 levels) in <top (required)>'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:87:in `instance_eval'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:87:in `block in run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:195:in `with_around_each_hooks'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:84:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:353:in `block in run_examples'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `map'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `run_examples'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:335:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `map'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block in run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/reporter.rb:34:in `report'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:25:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'

  2) OracleEnhancedAdapter logging dbms_output from plsql should log dbms output lines to the rails log
     Failure/Error: @conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").should == [{'is_it_long'=>1}]
       expected: [{"is_it_long"=>1}]
            got: #<ActiveRecord::Result:0x00000003c5b810 @columns=["is_it_long"], @rows=[[1]], @hash_rows=nil, @column_types={}> (using ==)
       Diff:
       @@ -1,2 +1,6 @@
       -[{"is_it_long"=>1}]
       +#<ActiveRecord::Result:0x00000003c5b810
       + @column_types={},
       + @columns=["is_it_long"],
       + @hash_rows=[{"is_it_long"=>1}],
       + @rows=[[1]]>
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/expectations/fail_with.rb:33:in `fail_with'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:47:in `fail_with_message'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:69:in `__delegate_operator'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:59:in `eval_match'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:28:in `block in use_custom_matcher_or_delegate'
     # ./spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb:53:in `block (2 levels) in <top (required)>'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:87:in `instance_eval'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:87:in `block in run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:195:in `with_around_each_hooks'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:84:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:353:in `block in run_examples'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `map'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `run_examples'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:335:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `map'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block in run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/reporter.rb:34:in `report'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:25:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'

  3) OracleEnhancedAdapter logging dbms_output from plsql should log dbms output lines to the rails log
     Failure/Error: @conn.select_all("select more_than_five_characters_long('short') is_it_long from dual").should == [{'is_it_long'=>0}]
       expected: [{"is_it_long"=>0}]
            got: #<ActiveRecord::Result:0x000000024f8830 @columns=["is_it_long"], @rows=[[0]], @hash_rows=nil, @column_types={}> (using ==)
       Diff:
       @@ -1,2 +1,6 @@
       -[{"is_it_long"=>0}]
       +#<ActiveRecord::Result:0x000000024f8830
       + @column_types={},
       + @columns=["is_it_long"],
       + @hash_rows=[{"is_it_long"=>0}],
       + @rows=[[0]]>
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/expectations/fail_with.rb:33:in `fail_with'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:47:in `fail_with_message'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:69:in `__delegate_operator'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:59:in `eval_match'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-expectations-2.10.0/lib/rspec/matchers/operator_matcher.rb:28:in `block in use_custom_matcher_or_delegate'
     # ./spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb:63:in `block (2 levels) in <top (required)>'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:87:in `instance_eval'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:87:in `block in run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:195:in `with_around_each_hooks'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:84:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:353:in `block in run_examples'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `map'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `run_examples'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:335:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `map'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block in run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/reporter.rb:34:in `report'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:25:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
     # /home/yahonda/.rvm/gems/ruby-1.9.3-p194@railsmaster/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'

Finished in 0.42575 seconds
3 examples, 3 failures

Failed examples:

rspec ./spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb:42 # OracleEnhancedAdapter logging dbms_output from plsql should NOT log dbms output when dbms output is disabled
rspec ./spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb:50 # OracleEnhancedAdapter logging dbms_output from plsql should log dbms output lines to the rails log
rspec ./spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb:60 # OracleEnhancedAdapter logging dbms_output from plsql should log dbms output lines to the rails log
$
@ebeigarts
Collaborator

Probably it would be enough to replace ....should with ...to_a.should

@yahonda
Collaborator
yahonda commented Jun 6, 2012

If reverted manually as follows,

$ git diff
diff --git a/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb b/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
index 140c6c6..0a7f6f6 100644
--- a/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
+++ b/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
@@ -1097,7 +1097,7 @@ module ActiveRecord
         SQL

         # added deletion of ignored columns
-        select_all(table_cols, name).to_a.delete_if do |row|
+        select_all(table_cols, name).delete_if do |row|
           ignored_columns && ignored_columns.include?(row['name'].downcase)
         end.map do |row|
           limit, scale = row['limit'], row['scale']
@@ -1273,7 +1273,7 @@ module ActiveRecord

       def select(sql, name = nil, binds = [])
         if ActiveRecord.const_defined?(:Result)
-          exec_query(sql, name, binds)
+          exec_query(sql, name, binds).to_a
         else
           log(sql, name) do
             @connection.select(sql, name, false)
$

All tests passes successfully.

$ rspec ./spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb
==> Running specs with MRI version 1.9.3
==> Running specs with Rails version 4.0-master
...

Finished in 0.52562 seconds
3 examples, 0 failures
$
@ebeigarts
Collaborator

Well in rails 4 select_all should return ActiveRecord::Result but in our tests we are still expecting Array, can you try adding to_a in specs?

@yahonda
Collaborator
yahonda commented Jun 6, 2012

Replacing should with to_a.should works like a charm! I'm opening a pull request including this fix.

@yahonda
Collaborator
yahonda commented Jun 6, 2012

Closed as dup of #180.

@yahonda yahonda closed this Jun 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.