Skip to content

[Ruby 2.5] FrozenError #557

Closed
Closed

Description

@marcandre

A huge bunch on specs should be modified to spec Ruby 2.5's behavior of raising a FrozenError when attempting to mutate a frozen object.

Instead duplicating the affected specs and referring to FrozenError directly, the helper frozen_error_class should be used (see this). As such, no direct mention of FrozenError should appear in the specs, only frozen_error_class.

Anyone wants to handle this?

Activity

  1. Atul9 commented on Dec 18, 2017

    @Atul9
    Contributor

    Yes, I have started working on this.

  2. Atul9 commented on Dec 18, 2017

    @Atul9
    Contributor

    In the spec description should we rename RuntimeError to frozen_error_class OR FrozenError

    • raises a RuntimeError if the array is frozen
      to
    • raises a frozen_error_class if array is frozen?
      OR
    • raises a FrozenError if array if frozen?
  3. marcandre commented on Dec 18, 2017

    @marcandre
    MemberAuthor

    Mmm, good question. Maybe simply "raises the appropriate error if the ..."

  4. eregon commented on Dec 18, 2017

    @eregon
    Member

    I think in this case it would be fine to use the new terminology (raises a FrozenError if the array if frozen), what do you think @marcandre ?
    I was thinking to raises a frozen error if the array if frozen but that's just misleading (as if the error was frozen).
    raises the appropriate error if the array if frozen doesn't say which so then we could just be generic and say raises an error if the array if frozen.

  5. eregon commented on Dec 18, 2017

    @eregon
    Member

    @Atul9 let's go with FrozenError in the description for now. It's easy to globally search/replace after if needed :)

  6. Atul9 commented on Dec 18, 2017

    @Atul9
    Contributor

    @eregon okay

  7. andrykonchin commented on Dec 18, 2017

    @andrykonchin
    Member

    @Atul9 I would choose interpolation

    it "raises a #{frozen_error_class} if the array if frozen"
  8. eregon commented on Dec 18, 2017

    @eregon
    Member

    @andrykonchin That's smart :)
    In general it's bad to have variable parts in the spec descriptions, because then they cannot be tagged reliably.
    But since frozen_error_class only changes per Ruby version it would be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions