1. 22 9月, 2015 1 次提交
  2. 19 9月, 2015 4 次提交
  3. 09 9月, 2015 1 次提交
    • E
      Handle Content-Types that are not :json, :xml, or :url_encoded_form · 43d7a03a
      eileencodes 提交于
      In c546a2b0 this was changed to mimic how the browser behaves in a real
      situation but left out types that were registered.
      
      When this was changed it didn't take `text/plain` or `text/html` content
      types into account. This is a problem if you're manipulating the
      `Content-Type` headers in your controller tests, and expect a certain
      result.
      
      The reason I changed this to use `to_sym` is because if the
      `Content-Type` is not registered then the symbol will not exist. If it's
      one of the special types we handle that specifically (:json, :xml, or
      :url_encoded_form). If it's any registered type we handle it by setting
      the `path_parameters` and then the `request_parameters`. If the `to_sym`
      returns nil an error will be thrown.
      
      If the controller test sets a `Content-Type` on the request that `Content-Type`
      should remain in the header and pass along the filename.
      
      For example:
      If a test sets a content type on a post
      ```
      @request.headers['CONTENT_TYPE'] = 'text/plain'
      post :create, params: { name: 'foo.txt' }
      ```
      
      Then `foo.txt` should be in the `request_parameters` and params related
      to the path should be in the `path_parameters` and the `Content-Type`
      header should match the one set in the `@request`. When c546a2b0 was
      committed `text/plain` and `text/html` types were throwing a "Unknown
      Content-Type" error which is misleading and incorrect.
      
      Note: this does not affect how this is handled in the browser, just how
      the controller tests handle setting `Content-Type`.
      43d7a03a
  4. 05 9月, 2015 2 次提交
  5. 01 9月, 2015 1 次提交
    • E
      Fix bug where cookies mutated by request were not persisted · 75a121a2
      eileencodes 提交于
      With changes made in 8363b8 and ae291421 cookies that are mutated on the
      request like `cookies.signed = x` were not retained in subsequent tests,
      breaking cookie authentiation in controller tests.
      
      The test added demonstrates the issue.
      
      The reason we need to select from non-deleted cookies is because without
      checking the `@delete_cookies` the `cookie_jar` `@cookies` will send the
      wrong cookies to be updated. The code must check for `@deleted_cookies`
      before sending an `#update` with the requests cookie_jar cookies.
      This follows how the cookie_jar cookies from the request were updated
      before these changes.
      75a121a2
  6. 26 8月, 2015 1 次提交
    • J
      Updating TestSession to access with indifference · 0258ef33
      Jeremy Friesen 提交于
      The following Rails code failed (with a `KeyError` exception) under
      test:
      
      ```ruby
      class ApplicationController < ActionController::Base
        def user_strategy
          # At this point:
          # ```ruby
          # session == {
          #   "user_strategy"=>"email",
          #   "user_identifying_value"=>"hello@world.com"
          # }
          # ```
          if session.key?(:user_strategy)
            session.fetch(:user_strategy)
          end
        end
      end
      ```
      
      When I checked the session's keys (`session.keys`), I got an array of
      strings. If I accessed `session[:user_strategy]` I got the expected
      `'email'` value. However if I used `session.fetch(:user_strategy)` I
      got a `KeyError` exception.
      
      This appears to be a Rails 4.2.4 regression (as the code works under
      Rails 4.2.3).
      
      Closes #21383
      0258ef33
  7. 25 8月, 2015 2 次提交
  8. 24 8月, 2015 4 次提交
  9. 18 8月, 2015 1 次提交
  10. 16 8月, 2015 1 次提交
    • E
      Refactor how assign_parameters sets generated_path & query_string_keys · f6232a51
      eileencodes 提交于
      This is part of a larger refactoring on controller tests. We needed to
      move these methods here so that we could get rid of the `|| key ==
      :action || key == :controller` in `assign_parameters`. We know this is
      ugly and intend to fix it but for now `generate_extras` needs to be used
      in the two methods to access the path and the query_string_keys.
      
      We're adding `:controller` and `:action` to the `query_string_keys`
      because we always need a controller and action. If someone passed
      `action` or `controller` in in there test they are unambigious - we
      know they have to go into the query params.
      f6232a51
  11. 08 8月, 2015 1 次提交
  12. 07 8月, 2015 1 次提交
  13. 15 7月, 2015 1 次提交
  14. 14 7月, 2015 3 次提交
  15. 11 7月, 2015 11 次提交
  16. 10 7月, 2015 1 次提交
    • A
      set parameters as a query string · 394b7be0
      Aaron Patterson 提交于
      We should convert request parameters to a query string, then let the
      request object parse that query string.  This should give us results
      that are more similar to the real-world
      394b7be0
  17. 09 7月, 2015 4 次提交