Skip to content

Fix top_level_description does not return always the same description

Created by: csaura

If the top_level_description is modified in one spec affects the next specs.

For example, I you are doing view specs for different formats, and the format is described in the top_level_description, the format will be removed in the following code:

actionpack-3.1.11/lib/action_view/renderer/abstract_renderer.rb

    # Checks if the given path contains a format and if so, change
    # the lookup context to take this new format into account.
    def wrap_formats(value)
      return yield unless value.is_a?(String)

      if value.sub!(formats_regexp, "")
        update_details(:formats => [$1.to_sym]){ yield }
      else
        yield
      end
    end

Example: The first time a a view spec the top_level_description /api/users.csv the second time the view is rendered the top_level_description is /api/users

Merge request reports