1. 20 8月, 2016 1 次提交
    • S
      Allow the `integration_sesion` to be set early on ActionDispatch::Integration::Runner. · a887c9cb
      Sam Phippen 提交于
      In commit fa634484, @tenderlove changed
      the behaviour of the way `integration_session` is set up in this object.
      It used to be the case that the first time it was accessed, it was
      memoized with nil, however, this means that if it had already been set
      it was not replaced. After that commit, it is now always set to `nil` in
      the execution of `before_setup`.
      
      In RSpec, users are able to invoke `host!` in `before(:all)` blocks,
      which execute well before `before_setup` is ever invoked (which happens
      in what is equivalent to a `before(:each)` block, for each test. `host!`
      causes the integration session to be set up to correctly change the
      host, but after fa634484 the
      `integration_session` gets overwritten, meaning that users lose their
      `host!` configuration (see https://github.com/rspec/rspec-rails/issues/1662).
      
      This commit changes the behaviour back to memoizing with `nil`, as
      opposed to directly overwriting with `nil`. This causes the correct
      behaviour to occur in RSpec, and unless I'm mistaken will also ensure
      that users who want to modify their integration sessions early in rails
      will also be able to do so.
      a887c9cb
  2. 15 8月, 2016 2 次提交
  3. 07 8月, 2016 4 次提交
  4. 06 8月, 2016 1 次提交
    • E
      Fix GET JSON integration test request to use method override · af1680f5
      eileencodes 提交于
      When a `GET` request is sent `as: :json` in an integration test the test
      should use Rack's method override to change to a post request so the
      paramters are included in the postdata. Otherwise it will not encode the
      parameters correctly for the integration test.
      
      Because integration test sets up it's own middleware,
      `Rack::MethodOverride` needs to be included in the integration tests as
      well.
      
      `headers ||= {}` was moved so that headers are never nil. They should
      default to a hash.
      
      Fixes #26033
      
      [Eileen M. Uchitelle & Aaron Patterson]
      af1680f5
  5. 27 7月, 2016 2 次提交
  6. 11 7月, 2016 1 次提交
    • K
      Let TestResponse assign a parser. · 333670ce
      Kasper Timm Hansen 提交于
      Previously we'd only assign a response parser when a request came through
      Action Dispatch integration tests. This made calls to `parsed_body` when a TestResponse
      was manually instantiated — though own doing or perhaps from a framework — unintentionally
      blow up because no parser was set at that time.
      
      The response can lookup a parser entirely through its own ivars. Extract request encoder to
      its own file and assume that a viable content type is present at TestResponse instantiation.
      
      Since the default response parser is a no-op, making `parsed_body` equal to `body`, no
      exceptions will be thrown.
      333670ce
  7. 02 7月, 2016 3 次提交
  8. 25 6月, 2016 3 次提交
  9. 27 5月, 2016 1 次提交
  10. 24 4月, 2016 1 次提交
  11. 12 4月, 2016 1 次提交
  12. 08 3月, 2016 1 次提交
  13. 07 3月, 2016 1 次提交
    • Y
      Prevent not-intended loading of `ActionDispatch::IntegrationTest` · 9a642931
      yui-knk 提交于
      After 9d378747 `ActionDispatch::IntegrationTest`
      class is loaded and defined in all Rails environments, not only test but also
      production. This is not-intended loading of a class which is only used in
      test environment.
      To prevent not-intended loading, add `ActiveSupport.run_load_hooks` to
      `ActionDispatch::IntegrationTest` with `action_dispatch_integration_test` name
      and use it in `ActionMailer`.
      9a642931
  14. 03 3月, 2016 1 次提交
  15. 01 3月, 2016 1 次提交
  16. 13 2月, 2016 1 次提交
    • K
      Add fixes accidentally removed. · da1fbb9a
      Kasper Timm Hansen 提交于
      Yesterday, when improving how `parsed_body` extracted a parser I wrote
      77bbf1e9. Then I thought that was too many changes in one commit
      and broke it up locally... or so I thought.
      
      When pushed the extra commits removed the changes! Wups!
      
      In shame, lob those changes together here:
      
        * 3b94c38a which meant to fix the CHANGELOG syntax error.
        * 5007df5e which meant to mention `parsed_body` in the docs.
        * 036a7a03 which meant to memoize the `parsed_body`.
      da1fbb9a
  17. 12 2月, 2016 2 次提交
  18. 11 2月, 2016 1 次提交
    • K
      Add `parsed_body` to spare writing out parsing routines. · eee3534b
      Kasper Timm Hansen 提交于
      When testing:
      
      ```ruby
      post articles_path, params: { article: { title: 'Ahoy!' } }, as: :json
      ```
      
      It's common to want to make assertions on the response body. Perhaps the
      server responded with JSON, so you write `JSON.parse(response.body)`.
      But that gets tedious real quick.
      
      Instead add `parsed_body` which will automatically parse the reponse
      body as what the last request was encoded `as`.
      eee3534b
  19. 03 2月, 2016 1 次提交
  20. 05 1月, 2016 1 次提交
  21. 07 12月, 2015 1 次提交
    • E
      Push `before_sending` to super class · 492b1344
      eileencodes 提交于
      We want to get rid of the `Live::Response` so we are consolidating methods
      from `Live::Response` and `Response` by merging them together.
      
      This adds an `#empty` method to the request so we don't need to
      hard-code the empty array each time we call an empty
      `ActionDispatch::Request`.
      
      The work here is a continuation on combining controller and integration
      test code bases into one.
      492b1344
  22. 28 10月, 2015 1 次提交
  23. 07 10月, 2015 1 次提交
    • J
      Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compat · 565094a8
      Jeremy Daer 提交于
      Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries
      that support multiple Rails versions would've had to feature-detect
      whether to use `Mime::Type[:FOO]` or `Mime::FOO`.
      
      `Mime[:foo]` has been around for ages to look up registered MIME types
      by symbol / extension, though, so libraries and plugins can safely
      switch to that without breaking backward- or forward-compatibility.
      
      Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup
      by type or extension, so it's not available as `Mime[:all]`. We use it
      internally as a wildcard for `respond_to` negotiation. If you use this
      internal constant, continue to reference it with `Mime::ALL`.
      
      Ref. efc6dd55
      565094a8
  24. 22 9月, 2015 1 次提交
  25. 22 8月, 2015 1 次提交
  26. 08 8月, 2015 1 次提交
    • A
      stop using @_env in the controller instance · 81cfdf24
      Aaron Patterson 提交于
      Actions are processed through `dispatch`, so they should have the
      request set on them before any user land code can be executed.  Lets
      stop setting _env on the controller, and give access to it through the
      `env` method.
      81cfdf24
  27. 07 8月, 2015 1 次提交
  28. 28 7月, 2015 1 次提交
  29. 01 6月, 2015 1 次提交
  30. 30 5月, 2015 1 次提交