1. 21 5月, 2019 6 次提交
    • R
      Merge pull request #36314 from kamipo/fallback_type_casting · 439145c9
      Ryuta Kamizono 提交于
      Fall back to type casting from the connection adapter
      439145c9
    • R
      Fall back to type casting from the connection adapter · 82a54be0
      Ryuta Kamizono 提交于
      Unfortunately, a11a8ff7 had no effect as long as using bind param, and
      was not tested.
      
      This ensures making the intent of a11a8ff7, which fall back to type
      casting from the connection adapter.
      
      Fixes #35205.
      
      ```
      % ARCONN=postgresql bundle exec ruby -w -Itest test/cases/relation/where_test.rb -n test_type_casting_nested_joins
      Using postgresql
      Run options: -n test_type_casting_nested_joins --seed 55730
      
      # Running:
      
      E
      
      Error:
      ActiveRecord::WhereTest#test_type_casting_nested_joins:
      ActiveRecord::StatementInvalid: PG::InvalidTextRepresentation: ERROR:  invalid input syntax for integer: "2-foo"
      
      rails test test/cases/relation/where_test.rb:30
      
      Finished in 0.245778s, 4.0687 runs/s, 0.0000 assertions/s.
      1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
      ```
      82a54be0
    • R
      Except SCHEMA SQLs in `capture_sql` · 0810c076
      Ryuta Kamizono 提交于
      Testing the result of `capture_sql` is fragile, it is due to whether
      SCHEMA SQLs are executed or not depends on whether schema cache is
      filled or not.
      
      https://buildkite.com/rails/rails/builds/61248#a5b9dc59-ff0c-40c0-b56e-0895662fbc4c/993-1004
      https://buildkite.com/rails/rails/builds/61248#1157b389-f2c7-4554-b6e5-a37624a0e74a/996-1005
      
      I've confirmed all `capture_sql` use cases in our code base, all cases
      won't expect SCHEMA SQLs are included.
      
      ```
      % git grep -n capture_sql
      test/cases/associations/belongs_to_associations_test.rb:202:    sql = capture_sql { comment.post }
      test/cases/associations/belongs_to_associations_test.rb:204:    assert_not_equal sql, capture_sql { comment.post }
      test/cases/associations/has_many_associations_test.rb:169:    sql = capture_sql { post.comments.to_a }
      test/cases/associations/has_many_associations_test.rb:171:    assert_not_equal sql, capture_sql { post.comments.to_a }
      test/cases/associations/has_many_associations_test.rb:276:    expected_sql = capture_sql { author.thinking_posts.delete_all }
      test/cases/associations/has_many_associations_test.rb:281:    loaded_sql = capture_sql { author.thinking_posts.delete_all }
      test/cases/associations/has_many_associations_test.rb:289:    expected_sql = capture_sql { author.posts.delete_all }
      test/cases/associations/has_many_associations_test.rb:294:    loaded_sql = capture_sql { author.posts.delete_all }
      test/cases/associations/left_outer_join_association_test.rb:22:      queries = capture_sql do
      test/cases/associations/left_outer_join_association_test.rb:49:    queries = capture_sql { Author.left_outer_joins(:posts).to_a }
      test/cases/associations/left_outer_join_association_test.rb:54:    queries = capture_sql { Author.joins(:posts).left_outer_joins(:posts).to_a }
      test/cases/associations/left_outer_join_association_test.rb:60:    queries = capture_sql { Author.left_outer_joins({}).to_a }
      test/cases/associations/left_outer_join_association_test.rb:65:    queries = capture_sql { Author.left_outer_joins([]).to_a }
      test/cases/associations/left_outer_join_association_test.rb:78:    queries = capture_sql { Author.left_outer_joins(:essays).to_a }
      test/cases/associations_test.rb:384:    log = capture_sql do
      test/cases/associations_test.rb:399:    log = capture_sql do
      test/cases/associations_test.rb:414:    log = capture_sql do
      test/cases/associations_test.rb:429:    log = capture_sql do
      test/cases/associations_test.rb:444:    log = capture_sql do
      test/cases/associations_test.rb:459:    log = capture_sql do
      test/cases/reflection_test.rb:307:    expected_sql = capture_sql { hotel.recipes.to_a }
      test/cases/reflection_test.rb:312:    loaded_sql = capture_sql { hotel.recipes.to_a }
      test/cases/relation_test.rb:212:      queries = capture_sql { Author.joins(:posts).merge(Post.joins(:comments)).to_a }
      test/cases/relation_test.rb:232:      queries = capture_sql { Post.joins(:author, :categorizations).merge(Author.select(:id)).merge(categorizations_with_authors).to_a }
      test/cases/relation_test.rb:347:      log = capture_sql do
      test/cases/scoping/relation_scoping_test.rb:146:      log = capture_sql do
      test/cases/scoping/relation_scoping_test.rb:159:    log = capture_sql do
      test/cases/test_case.rb:33:    def capture_sql
      test/cases/test_case.rb:41:      capture_sql { yield }
      ```
      0810c076
    • G
      Correct test name · 973096b6
      George Claghorn 提交于
      973096b6
    • R
      Merge pull request #36309 from alexandergraul/number_to_human_size_examples · d246e2f4
      Ryuta Kamizono 提交于
      Correct human file size examples [ci skip]
      d246e2f4
    • A
      Correct human file size examples [ci skip] · 2256f0bd
      Alexander Graul 提交于
      The `number_to_human_size` helpers in Action View and Active Support
      calculate the "human size" with a base of 1024. The examples should
      reflect that so they don't confuse the reader.
      
      The updated documentations use the values from:
      
          helper.number_to_human_size(1500)
      2256f0bd
  2. 20 5月, 2019 3 次提交
  3. 19 5月, 2019 6 次提交
    • R
      Merge pull request #36304 from kamipo/fix_through_association_with_joins · ea730adb
      Ryuta Kamizono 提交于
      Implicit through table joins should be appeared before user supplied joins
      ea730adb
    • R
      Implicit through table joins should be appeared before user supplied joins · 7412b7f8
      Ryuta Kamizono 提交于
      #36293 was an issue for through association with `joins` for a long
      time, but since #35864 through association with `left_joins` would also
      be affected by the issue.
      
      Implicit through table joins should be appeared before user supplied
      joins, otherwise loading through association with joins will cause a
      statement invalid error.
      
      Fixes #36293.
      
      ```
      % ARCONN=postgresql bundle exec ruby -w -Itest test/cases/associations/has_many_through_associations_test
      .rb -n test_through_association_with_joins
      Using postgresql
      Run options: -n test_through_association_with_joins --seed 7116
      
      # Running:
      
      E
      
      Error:
      HasManyThroughAssociationsTest#test_through_association_with_joins:
      ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  missing FROM-clause entry for table "posts"
      LINE 1: ... "comments_posts" ON "comments_posts"."post_id" = "posts"."i...
                                                                   ^
      : SELECT "comments".* FROM "comments" INNER JOIN "comments" "comments_posts" ON "comments_posts"."post_id" = "posts"."id" INNER JOIN "posts" ON "comments"."post_id" = "posts"."id" WHERE "posts"."author_id" = $1
      
      rails test test/cases/associations/has_many_through_associations_test.rb:61
      
      Finished in 0.388657s, 2.5730 runs/s, 0.0000 assertions/s.
      1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
      ```
      7412b7f8
    • G
      339be65d
    • G
      Prefer Capybara::Node::Element#execute_script · a0b10299
      George Claghorn 提交于
      a0b10299
    • E
      Return parameters enumerator from transform_keys/! · 46e84d5b
      Eugene Kenny 提交于
      Previously calling `ActionController::Parameters#transform_keys/!`
      without passing a block would return an enumerator for the underlying
      hash, which was inconsistent with the behaviour when a block was passed:
      
          ActionController::Parameters.new(foo: "bar").transform_keys { |k| k }
          => <ActionController::Parameters {"foo"=>"bar"} permitted: false>
          ActionController::Parameters.new(foo: "bar").transform_keys.each { |k| k }
          => {"foo"=>"bar"}
      
      An enumerator for the parameters is now returned instead, ensuring that
      evaluating it produces another parameters object instead of a hash:
      
          ActionController::Parameters.new(foo: "bar").transform_keys.each { |k| k }
          => <ActionController::Parameters {"foo"=>"bar"} permitted: false>
      46e84d5b
    • G
      Merge pull request #36122 from cseelus/respect-operating-system-color-scheme-for-errors · 88b12b2f
      Gannon McGibbon 提交于
      Regard operating system color scheme for rescues
      88b12b2f
  4. 18 5月, 2019 8 次提交
  5. 17 5月, 2019 1 次提交
  6. 16 5月, 2019 7 次提交
  7. 15 5月, 2019 3 次提交
  8. 14 5月, 2019 6 次提交