1. 22 9月, 2015 1 次提交
  2. 19 9月, 2015 4 次提交
  3. 16 9月, 2015 1 次提交
  4. 15 9月, 2015 7 次提交
  5. 11 9月, 2015 1 次提交
  6. 09 9月, 2015 4 次提交
    • 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
    • A
      push content_type assigment in to metal · cd8eb351
      Aaron Patterson 提交于
      everything above metal really doesn't care about setting the content
      type, so lets rearrange these methods to be in metal.
      cd8eb351
    • A
      avoid useless string allocations · 7056e2aa
      Aaron Patterson 提交于
      _set_content_type only does something when there is a request object,
      otherwise the return value of _get_content_type is always ignored. This
      commit moves everything to the module that has access to the request
      object so we'll never to_s unless there is a reason
      7056e2aa
    • A
      use accessors instead of manipulating the hash · b42c5863
      Aaron Patterson 提交于
      in the future I would like to make the header hash read only (or at
      least remove guarantees that mutations will do anything).
      b42c5863
  7. 05 9月, 2015 2 次提交
  8. 02 9月, 2015 1 次提交
  9. 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
  10. 30 8月, 2015 2 次提交
  11. 29 8月, 2015 3 次提交
  12. 28 8月, 2015 4 次提交
    • X
      revises 877e42e2 · cbe7899f
      Xavier Noria 提交于
      * A string in the example lacked quotes.
      
      * The tests asserted stuff about :last_name, whereas
        test params do not have that key.
      
      * But, the first one passed, why? After hitting my head against
        the wall and doing some obscure rituals realized the new
        #require had an important typo, wanted to iterate over the
        array argument (key), but it ran over its own hash keys
        (method #keys).
      
      * Modified the test to prevent the same typo to happen again.
      
      * The second test assigned to an unused variable safe_params
        that has been therefore removed.
      
      * Grammar of the second test description.
      
      * Since I was on it, reworded both test descriptions.
      cbe7899f
    • G
      [Feature] params.require requires array of params · 877e42e2
      Gaurish Sharma 提交于
      This PR adds ability to accept arrays which allows you to require multiple values in one method. so instead of this:
      
      ```ruby
      params.require(:person).require(:first_name)
      params.require(:person).require(:last_name)
      ```
      
      Here it will be one line for each params, so say if I require 10params, it will be 10lines of repeated code which is not dry. So I have added new method which does this in one line:
      
      ```ruby
      params.require(:person).require([:first_name, :last_name])
      ```
      
      Comments welcome
      877e42e2
    • A
      Revert "this always sets :public to false, so just do that" · bf203e47
      Aaron Patterson 提交于
      This reverts commit cae2b5bb.
      
      I am an idiot.
      bf203e47
    • A
      cae2b5bb
  13. 27 8月, 2015 9 次提交